Overall Statistics |
Total Trades 2 Average Win 0.01% Average Loss 0% Compounding Annual Return 5.955% Drawdown 8.400% Expectancy 0 Net Profit 5.520% Sharpe Ratio 0.578 Probabilistic Sharpe Ratio 30.832% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha -0.04 Beta 0.096 Annual Standard Deviation 0.074 Annual Variance 0.005 Information Ratio -1.299 Tracking Error 0.628 Treynor Ratio 0.444 Total Fees $44.24 Estimated Strategy Capacity $520000.00 Lowest Capacity Asset BTCUSDT 18N |
namespace QuantConnect.Algorithm.CSharp { public class BinanceBrokerageExampleAlgorithm : QCAlgorithm { private Symbol _symbol; public override void Initialize() { SetStartDate(2021, 1, 1); SetCash("USDT", 100000); SetBrokerageModel(BrokerageName.Binance, AccountType.Cash); _symbol = AddCrypto("BTCUSDT", Resolution.Minute).Symbol; // Set default order properties DefaultOrderProperties = new BinanceOrderProperties { TimeInForce = TimeInForce.GoodTilCanceled, PostOnly = false }; } public override void OnData(Slice data) { if (Portfolio.Invested) { return; } // Place an order with the default order properties MarketOrder(_symbol, 1); // Place an order with new order properties var orderProperties = new BinanceOrderProperties { TimeInForce = TimeInForce.Day, PostOnly = true }; var ticket = LimitOrder(_symbol, -0.5, Math.Round(data[_symbol].Price + 1000, 2), orderProperties: orderProperties); // If we try to call `Update`, an exception is raised // ticket.Update(...) // Update the order ticket.Cancel(); LimitOrder(_symbol, -0.5, Math.Round(data[_symbol].Price + 100, 2), orderProperties: orderProperties); } } }