| Overall Statistics |
|
Total Trades 11124 Average Win 0.01% Average Loss -0.01% Compounding Annual Return -98.417% Drawdown 24.500% Expectancy -0.991 Net Profit -24.483% Sharpe Ratio -6.696 Probabilistic Sharpe Ratio 0% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 1.03 Alpha -0.946 Beta 0.003 Annual Standard Deviation 0.141 Annual Variance 0.02 Information Ratio -0.98 Tracking Error 0.528 Treynor Ratio -364.722 Total Fees $24623.15 Estimated Strategy Capacity $14000000000.00 Lowest Capacity Asset ETHBTC E3 |
import time
class FormalSkyBlueChinchilla(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 7, 1)
self.SetCash(100000)
# self.SetCash("ETH", 1000)
self.symbols = [Symbol.Create("BTCUSD", SecurityType.Crypto, Market.Bitfinex),
Symbol.Create("ETHBTC", SecurityType.Crypto, Market.Bitfinex),
Symbol.Create("ETHUSD", SecurityType.Crypto, Market.Bitfinex)
]
## Manual universe selection with tick-resolution data
self.UniverseSettings.Resolution = Resolution.Minute
self.SetUniverseSelection(ManualUniverseSelectionModel(self.symbols))
self.SetExecution(ImmediateExecutionModel())
self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)
def OnData(self, data):
''' OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
## Check to make sure all currency symbols are present
if data.ContainsKey("BTCUSD") and data.ContainsKey("ETHBTC") and data.ContainsKey("ETHUSD"):
## Extract QuoteBars for all three Forex securities
bar_a = data["BTCUSD"].Ask.Close
bar_b = data["ETHBTC"].Ask.Close
# since this is shorting, you should use Bid
bar_c = data["ETHUSD"].Bid.Close
triangleRate = bar_c*(1/bar_a) *(1/ bar_b)
if triangleRate > 1 and not self.Portfolio.Invested:
self.MarketOrder("BTCUSD", 0.1)
self.MarketOrder("ETHBTC", 0.1*bar_b/bar_a)
self.MarketOrder("ETHUSD", -0.1*bar_b/bar_a)
elif triangleRate < 1:
self.Liquidate()