Good Afternoon fellow developers

 

I'm quite new to Futures trading, and currently, I'm working on a project for a trading company in brazil to hedge their regular operations in the petrol industry by utilizing correlation coefficient to further understand and predict the direction of the USDBRL to facilitate the closing of exchange rates on their operations. 

 

I have been using Quandl data from Nasdaq data Link, but due to its nature which is updated daily, I can't get a precise understanding of the nature of this operation I'm trying to perform. 

This is Code I will share below am just trying to add “6L” data to my algorithm with SMA. 

Any help is greatly appreciated, I look forward to sharing the complete project involving CFD, Interest Rates, and Forex and Futures. 

Thank You

  1. class MuscularSkyBlueLeopard(QCAlgorithm):
  2. def Initialize(self):
  3. self.SetStartDate(2022, 5, 10) # Set Start Date
  4. self.SetCash(100000) # Set Strategy Cash
  5. #self.AddForex("CADJPY", Resolution.Hour)
  6. #self.smaFast = self.SMA("CADJPY", 4)
  7. #self.smaSlow = self.SMA("CADJPY", 30)
  8. self.AddFuture("6L",Resolution.Hour )
  9. future = self.AddFuture(Futures.Currencies.BRL)
  10. future.SetFilter(timedelta(30), timedelta(182))
  11. #self.smaBrazilFast = self.SMA(future, 30)
  12. #self.smaBrazilSlow = self.SMA(future, 200)
  13. #-------------#USDBRL------------------------------------------------------
  14. #self.quandlCode_Brazil_USDBRL="FED/RXI_N_B_BZ"
  15. #self.AddData(QuandlCustomColumns, self.quandlCode_Brazil_USDBRL, Resolution.Minute, TimeZones.NewYork)
  16. #self.smaBrazilPrice = self.SMA(self.quandlCode_Brazil_USDBRL, 1)
  17. #self.smaBrazilFast = self.SMA(self.quandlCode_Brazil_USDBRL, 30)
  18. #self.smaBrazilSlow = self.SMA(self.quandlCode_Brazil_USDBRL, 200)
  19. def OnData(self, slice):
  20. for chain in slice.FutureChains.Values:
  21. contracts = chain.Contracts
  22. for contract in contracts.Values:
  23. pass
  24. #if self.smaBrazilFast.Current.Value > self.smaBrazilSlow.Current.Value:
  25. #self.SetHoldings("CADJPY",-0.1)
  26. #else:
  27. self.SetHoldings(future,1)
  28. self.Plot("CADJPY","CADJPY", self.Securities["CADJPY"].Price)
  29. self.Plot("CADJPY", "CADJPY Fast", self.smaFast.Current.Value)
  30. self.Plot("CADJPY", "CADJPY Slow", self.smaSlow.Current.Value)
  31. #self.Plot("PAIR","USDBRL", self.Securities["6L"].Price)
  32. #self.Plot("PAIR", "USDBRL Fast", self.smaBrazilFast.Current.Value)
  33. #self.Plot("PAIR", "USDBRL Slow", self.smaBrazilSlow.Current.Value)
  34. #--------------------Import collumns----------------------------------------------------
  35. class QuandlCustomColumns(PythonQuandl):
  36. def __init__(self):
  37. self.ValueColumnName = "Value"
+ Expand

Author

Luis roldan

May 2022