Overall Statistics |
Total Trades 9 Average Win 0% Average Loss 0% Compounding Annual Return 978235.597% Drawdown 12.100% Expectancy 0 Net Profit 37.991% Sharpe Ratio 5.962 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 496.581 Annual Standard Deviation 1.067 Annual Variance 1.139 Information Ratio 5.95 Tracking Error 1.067 Treynor Ratio 0.013 Total Fees $302.96 |
namespace QuantConnect.Algorithm.CSharp { public class BasicTemplateAlgorithm : QCAlgorithm { decimal cashLeft = 100000; public override void Initialize() { SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash); SetStartDate(2017, 12, 01); //Set Start Date SetEndDate(2017, 12, 12); //Set End Date SetCash(cashLeft); //Set Strategy Cash AddCrypto("BTCUSD", Resolution.Daily, Market.GDAX); } public override void OnData(Slice data) { Debug("BTC Price is $" + data.Bars["BTCUSD"].Close + " and Buying Power is $" + Portfolio.GetBuyingPower("BTCUSD")); if (Portfolio.GetBuyingPower("BTCUSD") > data.Bars["BTCUSD"].Close) { var ticket = MarketOrder("BTCUSD", 1); if (ticket.Status == OrderStatus.Filled) { var fills = ticket.OrderEvents.Where(orderEvent => orderEvent.Status.IsFill()).ToList(); Debug("Bought! Now have " + Portfolio["BTCUSD"].Quantity + " coins"); cashLeft -= fills.Sum(fill => fill.FillPrice); Debug("Actual Cash Left: " + cashLeft); Debug("Delta Cash (error): " + (Portfolio.GetBuyingPower("BTCUSD") - cashLeft)); Debug(" "); } else { Debug("Failed Fill"); Debug(" "); } } else { Debug("Not enough buying power"); Debug(" "); } } } }