Back

Deep dive analysis and fee model

Hi,

Got a couple of quick questions hopefully:

1) Working on intraday strategy and to analyse result in detail, I need to plot minute prices and various indicators. Custom charting limits series to 4000 data points so wouldn't work. Thought about logging data and plotting on my desktop using another package however log file limited to 100kb. Any other alternative? My only thought is to source data myself, then run LEAN  locally. Would I be able to write log file with no limit to size?

2) Have set broker to self.SetBrokerageModel(BrokerageName.FxcmBrokerage). How do I inspect and if necessary change the fee structure? Tried feemodel=forexsecurity.FeeModel.GetFeeModel(forexsecurity) but didn't work.

Thanks.

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Dat En, 

I can help answer your first question. You can try creating a data dictionary to store your values and develop a form of analysis within your algorithm. In terms of plotting, consider plotting using hour bars instead of minute, it requires much less memory. From my experience, a scatter plot with buy and sell prices coupled with a line chart of my indicator was sufficient. I've also used the tagging feature to tag orders with relevant information to make sure my algorithm was working correctly. 

There are also other ways to conduct analysis using the research notebooks. If you are interested in statistically modeling your alphas, take a look at Quantopians Alphalens and the lecture regarding factor analysis. Please let me know if this helps or if you have any questions :) 

Cheers

0

Thanks Jovad for the suggestions. However in my case I still need to plot at higher resolution and be able to zoom in to periods of interest. I will have look at Alphalens.

0

Hi Dat,

  1. There are no logging limits if LEAN is run locally
  2. To see the Fxcm fee model details, I will link to the implementation here. According to this link, this is the fee structure (as of on Oct 6th, 2015):
  • Forex:
  • $0.04 per side per 1k lot for EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, EURJPY, GBPJPY
  • $0.06 per side per 1k lot for other instruments
  • CFD: no commissions

To set custom fee models, we first need to define a custom fee model class. Here is one example pulled from the documentation:

class CustomFeeModel:
def GetOrderFee(self, parameters):
fee = max(1, parameters.Security.Price
* parameters.Order.AbsoluteQuantity
* 0.00001)
return OrderFee(CashAmount(fee, 'USD'))

Then, we need to set our security fee models (here we use EURUSD) to this model using the following:

self.AddForex('EURUSD', Resolution.Daily, Market.FXCM)
self.Securities['EURUSD'].SetFeeModel(CustomFeeModel())

Please see the attached backtest for reference.

Best,
Shile Wen

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed