Designer
schemes and C#
API is a free algorithmic trading library for C# and Python. It works in two ways: as code inside Designer — a cube with a script, your own indicator or a scheme element — and as an SDK for your own p...
Install-Package StockSharp.Samples -Version 5.0.171
API is a free algorithmic trading library for C# and Python. It works in two ways: as code inside Designer — a cube with a script, your own indicator or a scheme element — and as an SDK for your own programs, from a console robot to a trading terminal. All of our programs are built on it: Designer, Terminal, Hydra, Shell, Runner and connectors such as MatLab.
A robot is written in Visual Studio. From connection to order it takes three steps.
1. Connect to a venue
var connector = new Connector();
connector.Adapter.InnerAdapters.Add(new BinanceMessageAdapter(connector.TransactionIdGenerator)
{
Key = key.Secure(),
Secret = secret.Secure(),
});
connector.Connect();
2. Subscribe to candles
var subscription = new Subscription(TimeSpan.FromMinutes(5).TimeFrame(), security);
connector.CandleReceived += (sub, candle) =>
{
if (sub == subscription)
Console.WriteLine($"{candle.OpenTime:t} {candle.ClosePrice}");
};
connector.Subscribe(subscription);
3. Register an order
connector.RegisterOrder(new Order
{
Portfolio = portfolio,
Security = security,
Side = Sides.Buy,
Volume = 1,
Type = OrderTypes.Market,
});
Switching venues means switching the adapter in the first step. The rest of the code stays the same: subscriptions, orders and positions work identically for an exchange, a broker and a crypto exchange.
schemes and C#
trading from the chart
data and storage
robot skeleton
running on a server
the same SDK
The robot is not tied to a broker's API: moving from Quik to Transaq, or from forex to a stock exchange, does not rewrite the strategy.
Order handling inside the library takes microseconds; hundreds of strategies across different instruments run at the same time.
Testing runs on ticks and order books, with slippage and the order queue — not on candle closing prices.
The same code can stay a cube inside Designer, or be built into a separate application — the API is the same.
Login to write a review