Manual and algorithmic trading in Stocksharp, robot development

Софт и программы для трейдинга

Stocksharp (S#) – a set of software for trading, creating trading strategies and creating trading robots (regular or HFT), usage features, where to download and how to use, interface features. StockSharp is an innovative software that allows users to create full-cycle automations (analysis/testing/trading) and
develop trading bots on their own . In addition to the standard technical analysis package, the platform contains a unique visual strategy builder. API connection is available for trading robots and third-party software. Below you can learn more about Stocksharp (S# – short), as well as evaluate the advantages and disadvantages of the popular platform.
Manual and algorithmic trading in Stocksharp, robot development

StockSharp Licensing

Users are given the opportunity (https://doc.stocksharp.ru/topics/License.html) to choose the most appropriate type of license: extended/corporate/corporate plus/private trader/crypto trader.

Private trader

This type of license is provided free of charge after registration. The following programs will be available to the user:

  • S#.Designer – designer of trading strategies https://stocksharp.ru/store/%D0%B4%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD%D0%B5%D1%80 %20%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D0%B9/;
  • S#.Data Hydra – a program for automatically downloading and storing historical market data https://stocksharp.ru/store/hydra/;
  • S#.Terminal trading terminal https://stocksharp.ru/store/%D1%82%D0%BE%D1%80%D0%B3%D0%BE%D0%B2%D1%8B%D0%B9%20 %D1%82%D0%B5%D1%80%D0%BC%D0%B8%D0%BD%D0%B0%D0%BB/;
  • S#.API – a library for developing trading robots https://stocksharp.ru/store/api/.

Manual and algorithmic trading in Stocksharp, robot development

Crypto Trader

The Crypto Trader license provides access to the following platforms: Binance/ Bitalong/Bitbank/Bitexbook/Bitfinex/Bithumb/BitStamp/BitMEX/Bittrex/WEX (BTC-e)/CEX.IO/Coinbase/Coincheck/CoinExchange/CoinCap/Coinigy/Cryptopia /Deribit/EXMO/DigiFinex/ DigitexFutures/GDAX/HitBTC/Huobi/IDAX/Kraken/KuCoin/Liqui/Livecoin/OKCoin/OKEx/Poloniex/PrizmBit/QuoineX/TradeOgre/YoBit/Zaif/LBank/BitMax/BW/Bibox/CoinBene /BitZ/ZB.

Extended license

The extended license allows users to simultaneously connect up to 3 programs to
the QUIK terminal . Access to video lessons, the duration of which exceeds 40 hours, and ready-made trading strategies is open.

Note! StockSharp’s technical support service quickly responds to emerging issues, helping the client solve any problem related to the operation of the software.

Corporate license

You will have to pay a fee to get a volume license. In addition to the basic/advanced license functionality, the user will be given direct access to:

  • derivatives market on the Moscow Exchange ;
  • the stock market on the Moscow Exchange;
  • LSE/NASDAQ exchange.

Also, traders can manage orders on the derivatives market of the Moscow Exchange and connect to trading using the FIX/FAST protocol.

Corporate plus

The corporate plus license includes the source codes of any ready-made software solutions (S#.Data/S#.Designer/S#.Shell). There are also source codes for the platform itself: S#.API.

Manual and algorithmic trading in Stocksharp, robot development
S# architecture

Stocksharp source codes on Github

The S# core is developed within the Open Source community. S# is available as source in the GitHub/StockSharp repository at https://github.com/StockSharp/StockSharp. Components by type will be available with source codes:

  • common classes that are used in the process of creating your own connections;
  • trading simulator;
  • history simulator;
  • a huge number of technical analysis indicators (more than 70);
  • logging.

Manual and algorithmic trading in Stocksharp, robot developmentAfter transferring money for the purchase of StockSharp, access to the source codes of closed components will be made available. A trader can use profit/loss/slippage/lag algorithms, as well as building candles of any time frame.
Manual and algorithmic trading in Stocksharp, robot development

Note! For beginners in the field of trading, the S#.Studio graphical environment is suitable, which greatly simplifies the process of creating and testing robots for trading.

GitHub guide – https://stocksharp.ru/forum/4848/rukovodstvo-po-github/

Installation Features

Most novice users do not understand how to properly launch StockSharp, install programs and update the software if necessary. The information below will help you understand how to install StockSharp.

launch

To install S#.Installer, users will need to follow the link https://stocksharp.ru/products/download/ and take care of downloading the distribution. The Installer.zip.Installerzip Properties block is removed.
Manual and algorithmic trading in Stocksharp, robot developmentTo do this, right-click on the file and select properties. The archive is unpacked. In the folder that opens, you will need to find the StockSharp.Installer.Console.bat file. Next, start the installation mode of this file and wait for the installation process to complete.
Manual and algorithmic trading in Stocksharp, robot developmentAt the next stage, they enter the login and the secret StockSharp combination required to enter the program. When the installation process is completed, a software window will open on the screen.
Manual and algorithmic trading in Stocksharp, robot development

Software installation and removal

The developers made sure that it was convenient for users to search in the program, and provided the ability to select the type of applications.
Manual and algorithmic trading in Stocksharp, robot developmentTo install the application, traders select the program and click on the “Install” command. Then confirm agreement with the terms of the license agreement and tap on the “Continue” button.
Manual and algorithmic trading in Stocksharp, robot developmentNext, select the installation path. At the same time, it is worth remembering that the folder in which the program is installed must be empty. After that, click on the “Continue” button again, select the “Run” command and wait for the installation to complete.
Manual and algorithmic trading in Stocksharp, robot developmentNow the software is ready to use! Advice! If there is a need to remove the software, users select the “Uninstall” command and click on the “Continue” button. In order to restore the software, you should click on the “Restore” command and click on the “Continue” button.

Program update features

The developers made sure that S#.Installer independently tracks software updates and automatically launches them. That is why after the installation is completed, it is better not to uninstall the program. To check available updates manually, you should click on the “Updates” button. You can find it in the right corner of the software window. If updates are available, a notification will appear on the screen. Now you need to tap on the button.

It is recommended to close S#.Installer through the toolbar. For this purpose, a transition to the menu is performed. Right-click on the “Close” button.

Manual and algorithmic trading in Stocksharp, robot development

S#.API – a library for writing trading robots in C# in Visual Studio

S#.API is a free library that will be useful for both beginners and professionals in the field of
algorithmic tradingTesting on ticks/glasses is as accurate as possible. Real slippage is determined. You can download API and documentation for S#.API StockSharp at https://stocksharp.ru/store/api/ Quick start in StockSharp, creating a trading robot for Quik: https://youtu.be/F51bGEpTOvo

Features of installing S#.API

Since version 5.0, the installation of S#.API is done via NuGet. For previous versions, you should choose to install from the StockSharp Releases repository from the GitHub web service.

Features of installing from GitHub

First of all, users register on
GitHub . Next, go to the github.com/StockSharp/StockSharp page in the StockSharp repository and select the icon labeled “Releases”. A window will open on the screen in which you need to select the S# version (from the Downloads section) and download the necessary archives. The downloaded archives are unlocked and unzipped.

For your information! In the archives StockSharp_#.#.#. contains zip-files of the library / source codes of examples. You can find the source codes in the Source Code archives.

Manual and algorithmic trading in Stocksharp, robot development

Installing with Nuget

Using Nuget, users can install the S# library. To install the source codes and examples, you will need to go to GitHub.
Manual and algorithmic trading in Stocksharp, robot developmentIn Solution Explorer, right-click on the solution name. After going to the context menu, select Manage NuGet Packages for Solution. A window will open on the screen in which you need to tap on the Online tab. Type StockSharp into the search bar. When the package for installing the StockSharp API is found, you need to click on “Install”. Once the package installation is complete, Packages will appear in the folder. By opening the “Packages” you can make sure that it contains StockSharp.#.#.# with the latest version of S#.
Manual and algorithmic trading in Stocksharp, robot development

Connectors

You need to work with stock exchanges and data sources in StockSharp through the Connector base class. The source codes can be found in the Samples/Common/SampleConnection project.
Manual and algorithmic trading in Stocksharp, robot developmentFirst of all, you need to take care of creating an instance of the
Connector class https://doc.stocksharp.ru/api/StockSharp.Algo.Connector.html :

public Connector Connector;

public MainWindow()
{
InitializeComponent();
Connector = new Connector();
InitConnector();
} In a special graphical interface that is designed to configure the Connector for S#.API, it is possible to configure multiple connections at the same time.
Manual and algorithmic trading in Stocksharp, robot developmentIt is also possible to add a connection directly from the code (without graphical windows). To do this, you need to use the TraderHelper.AddAdapter<TAdapter>(StockSharp.Algo.Connector connector, System.Action<TAdapter> init) extension. The number of connections in one Connector object is unlimited. Users can connect to multiple exchanges/brokers at the same time.

Note! Event handlers should be set in the InitConnector method.

Applications

Using the Order object, you can create a new order. Using the Connector.RegisterOrder(StockSharp.BusinessEntities.Order order) method, which sends an order to the server, the user will be able to register it on the exchange. If there is a need to create a stop order, experts advise taking care of specifying the Order.Type property as OrderTypes.Conditional. For further work with applications, the same object is used.

Tools

Security is a financial instrument used for trading. The instrument can be a stock/future/option, etc. The developer divided the tool baskets into classes:

  • IndexSecurity;
  • Continuous Security;
  • WeightedIndexSecurity.

Data storage

In StockSharp, you can save data for later download. As a rule, it is necessary to store data to accumulate analysis / search for patterns, save market data from the
trading terminal (for testing bots). Data storage is absolutely transparent, because the developer took care of high-level access and hiding inside the technical details.

S#.Designer is a universal designer program for creating trading robots and strategies

S#.Designer is used to create, test and manage trading strategies in real trading. There are several types of creating strategies that this program offers. They are using:

  1. Kubikov. In this case, the user may not have programming skills. To create strategies, you will need to use the method of connecting lines and combining cubes.
  2. C#. This option is suitable for experienced programmers who are not afraid of working with code. Such a strategy is not limited in the possibilities for creation. It can describe any algorithms, unlike cubes. The strategy is created directly in S#.Designer or in the C# development environment.

During the first launch of S#.Designer, a window will appear on the screen in which you will need to select a launch mode.
Manual and algorithmic trading in Stocksharp, robot developmentAfter that press the OK button. During the first launch of S#.Designer, you will be prompted to open a data download window. To download historical data, you will need to install the S#.Data program (codenamed Hydra). After clicking on the Download tool button, a corresponding window will appear on the screen, in which you will need to enter the code and type of tool / data source. Next, click on the OK button. The tools that S#.Designer will find can be found in the All Tools panel.
Manual and algorithmic trading in Stocksharp, robot development

Note! The most popular free source of historical data for the Russian market is Finam broker. The default data source is S#.Designer.

Manual and algorithmic trading in Stocksharp, robot developmentTo get historical data, go to the All instruments category and tap on the name of the required instrument. Next, set the period of historical data / type / Time Frame of candles and click on the Start button.
Manual and algorithmic trading in Stocksharp, robot developmentAfter the historical data is obtained, one of the demonstration strategies should be preferred. To do this, go to the Schemes panel. In the Strategies folder, select an example SMA strategy. When you navigate to a strategy, the Emulation tab opens in the ribbon. Here you can find the basic elements for creating a strategy / debugging / testing.
Manual and algorithmic trading in Stocksharp, robot developmentIn this tab, set the testing period and Market data storage in the “Market data” field. Next, select the necessary tools and set the type/Time Frame of the candles in the Block Properties category. Trading emulation starts immediately after the Start button is pressed.

https://youtu.be/NrzI4yJFg7U Stocksharp Lesson Two: https://youtu.be/N_AFlKYP2rU Lesson Three: https://youtu.be/f75zeQL5Ucw

S#.Terminal – trading terminal

S#.Terminal is a free trading terminal, the main advantage of which is the simultaneous connection to a large number of trading platforms. Support for more than 70 connections from different exchanges of the world is available. Time frames are arbitrary.
Manual and algorithmic trading in Stocksharp, robot developmentDuring the first launch of S#.Terminal, you will need to select the launch mode and click on the OK button. A terminal window will appear on the screen. Components are set by default. After editing the connection settings, you need to click on the “Connect” button.
Manual and algorithmic trading in Stocksharp, robot developmentTo add a new chart area, users tap on the “Add” command. By clicking the second mouse button in the same place, you can add candles for the instruments of interest / indicators / orders and your own deals. In the Trades category, traders will be able to view trades by instrument. If the need arises, merchants will always have the option of adding additional components.
Manual and algorithmic trading in Stocksharp, robot development

S#.Data (Hydra) – market data downloader

The developers have created S#.Data (Hydra) software for automatic loading of market data (instruments/candles/tick deals/DOM) from various sources. The data can be saved in the local storage in the S#.Data (BIN) text format, which provides convenient data analysis in other software, or in a special binary format that provides the maximum compression level. The information that has been saved will become available for use by trading strategies. To access the data, you will need to use the StorageRegistry or regular uploads in the Excel/xml/txt format. S#.Data allows you to use both real-time and historical data sources at the same time. This advantage is achieved through the use of an extensible source model. During the first launch of the program, a window will open on the screen,
Manual and algorithmic trading in Stocksharp, robot developmentTo open the data source selection window, you need to go to the “General” category and tap on the “Add” section and the “Sources” folder.
Manual and algorithmic trading in Stocksharp, robot developmentIn the window that opens, mark the necessary sources. It is allowed to use filters by region/electronic site/data type/real time. Click OK to complete the selection process. After that, the software will prompt users to enable utilities. By clicking on OK, the merchant will be able to add sources to the left panel of the application’s main window.
Manual and algorithmic trading in Stocksharp, robot development

S#.Shell – ready-made graphical framework with source codes

S#.Shell is a ready-to-use graphical framework that allows you to make quick changes based on user requirements and is completely open source in the C# language. The robot will quickly create a graphical interface, save and restore the strategy settings, provide detailed information about the operation of the strategy, and automatically launch it on schedule. When you start S#.Shell, the Shell project will appear in Solution Explorer.
Manual and algorithmic trading in Stocksharp, robot developmentThe Strategies folder contains several strategies that are included in the S#.Shell/Helpering Interfaces/Wrapper for Default Strategies. When the project is launched, a window will open on the screen, in the upper area of ​​\u200b\u200bwhich you can find:

  • connection settings buttons;
  • button to save the current Shell configuration;
  • main tabs.

Manual and algorithmic trading in Stocksharp, robot developmentAfter going to the connection settings, you will need to select the type of connection. As soon as the user manages to connect, it is worth going to the “General” category and familiarizing yourself with the instruments / portfolio contents / orders / own trades.
Manual and algorithmic trading in Stocksharp, robot developmentNext, go to the “Real-time” tab in order to add a strategy to start trading. After adding a strategy, a trader can proceed to filling in its main parameters by type of Instruments, Portfolio, etc.

Note! In the “Emulation” category, it is possible to run strategy testing on historical data.

Manual and algorithmic trading in Stocksharp, robot developmentBasic online course on algorithmic trading using the StockSharp platform: https://youtu.be/lileOIlcNP4

S#.MatLab – MatLab integration with trading systems

The developers have created S#.MatLab – a link to the product https://doc.stocksharp.ru/topics/MatLab.html for trading specialists who write trading algorithms within the MatLab MathWorks environment. The presence of the S#.MatLab integration connector makes it possible to connect to almost any broker/exchange. MatLab scripts, after receiving data from trading platforms, send trading orders to them. To get detailed settings, scripts and documentation, you will need to purchase S#.MatLab.
Manual and algorithmic trading in Stocksharp, robot development

Trading from MatLab scripts

CSV files collect and store data. Current quotes are written in lines. The columns indicate the entire range of bid/ask quotes for each currency pair. If you can’t keep your PC on all the time, don’t worry. The data in this case will come in blocks. After downloading, you can close the program, rename the file so as not to get lost and restart it after a certain period of time.

Note! The size of arrays with data blocks will be different. Data blocks are stored in PRICES (global variable).

When creating a strategy, you should make sure that they accept only their own parameters as input. The initial data is transferred through global variables. When a trade is closed, the global variables are adjusted to characterize the quality of the strategy. To optimize these characteristics, you should create a “shell” inside which global variables will be initialized.

For your information! Each time a trade is closed, the performance of the strategy is updated.

All Stocksharp documentation at https://doc.stocksharp.ru/

Champions League Viewer – charts of the Champions League competition with deals of participants

LCH Viewer is a software that displays trades of LCH participants on a chart with indicators. In the photo below you can see what the display of several tools will look like.
Manual and algorithmic trading in Stocksharp, robot developmentIt is also possible to view trades of HFT robots on the RI tick chart.
Manual and algorithmic trading in Stocksharp, robot developmentthat the software provides a huge number of possibilities. The connection is supported not only to Russian, but also to American brokers, which is an additional advantage.

Поделиться ссылкой:

Rate this post
Rate author
Programming, investment and algorithmic trading
Add a comment