Overall Statistics
Total Trades
10377
Average Win
0.01%
Average Loss
-0.01%
Compounding Annual Return
-31.718%
Drawdown
12.400%
Expectancy
-0.219
Net Profit
-12.034%
Sharpe Ratio
-9.136
Loss Rate
60%
Win Rate
40%
Profit-Loss Ratio
0.94
Alpha
-0.603
Beta
18.828
Annual Standard Deviation
0.033
Annual Variance
0.001
Information Ratio
-9.632
Tracking Error
0.033
Treynor Ratio
-0.016
Total Fees
$0.00
import io, requests
import numpy as np
import pandas as pd
from datetime import timedelta

trade_assets = ['EURAUD', 'EURNZD', 'GBPAUD', 'GBPNZD', 'AUDUSD', 'NZDUSD']
leverage_ratio = 1.0

class BasicTemplateAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2019,1,1)  #Set Start Date
        self.SetEndDate(2019,5,3)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        for asset in trade_assets: self.AddForex(asset, Resolution.Hour, Market.Oanda, True, 1.0)
        self.History(512, Resolution.Hour)
        self.SetBenchmark("EURUSD")
    def OnData(self, data):
        portfolio_weights = np.random.rand(len(trade_assets))
        portfolio_weights /= np.sum(np.abs(portfolio_weights))
        portfolio_weights *= leverage_ratio
        for i, asset in enumerate(trade_assets): 
            self.SetHoldings(asset, portfolio_weights[i])