cuemacro / finmarketpy

Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)
http://www.cuemacro.com
Apache License 2.0
3.41k stars 490 forks source link

spread trading costs #20

Open mg64ve opened 5 years ago

mg64ve commented 5 years ago

Hi,

nice library! I have a question, is finmarketpy considering spread trading costs?

Kindly let me know. Thanks.

Regards.

ShihHauTan commented 5 years ago

Hi, yes you can add transaction costs in your backtesting model. Under the load_parameters function, you can define br.spot_tc_bp = 0.5, for example, to add the transaction cost into the trading.

mg64ve commented 5 years ago

Thanks ShihHauTan, what does 0.5 stand for? Is it PIPS or percentage? How are trading costs calculated?

mg64ve commented 5 years ago

@ShihHauTan one more question: walk-forward testing for machine learning models, is it implementable in finmarketpy ?

saeedamen commented 5 years ago

I think that is probably something you can implement in finmarketpy (but it isn't there at the moment)

mg64ve commented 5 years ago

Thanks @ShihHauTan , sorry for so many questions but, before dedicating a lot of time and finally find that is not be feasible, I'd prefer to ask. What I want to do is to build a machine learning model within in-samples dataset and then test it in ot-of-samples dataset. Do you think it is feasible with a simple loop? Do you have an example of simple machine learning strategy?