Having a little time on my hands (and sufficient naivety) I've decided to implement a Bitfinex brokerage. I'm taking this as a learning experience having been developing in C# for a long time but never being involved in trading systems. I have toyed with simple algorithms through LEAN in backtesting and paper trading with a simulated broker, so am in the process of integrating with the Bitfinex api as the next logical step. I'd guess at this stage I'm about halfway towards an end-to-end trade.
I'm open minded about how I go about this so would be interested in any advice. I'm also already aware that this whole effort is likely a fool's errand, so I don't mind hearing exactly how foolish it is and how unlikely it is that this will ever result in something that turns a profit.
Jared Broad
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.
Nicholas Stein
James Smith
James Smith
Jared Broad
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.
James Smith
Second planned stage of Bitfinex websockets integration is now complete. I've been live trading and Alpha testing for a few weeks now, My fork passes all brokerage unit tests. We're probably not ready for a PR until 3rd party library is refactored. Regardless, can now trade Bitcoin with Lean. https://github.com/RicksonByArmbar/Lean
Jared Broad
@James that is epic! Creating a brokerage is a big endeavor -- nicely done! Please feel free to do a PR when you think its ready. We'll put it through our own testing and add the option to live trade with BTC in the QuantConnect.com GUI!
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.
James Smith
It's great you're so enthusiastic. The project has been a lot of fun. I'm getting near the point a public beta would be beneficial. In terms of refactoring the 3rd party library, the code is clean and efficient, but there are two issues: 1. Log4Net is used for logging which is superfluous with custom logging stack. 2. It relies on app.config whereas LEAN uses config.json. I have leveraged xml transforms for app.config very effectively in the past so admit I miss having this capability. Apart from that I need to comment and perform some QC, but it's not that far away from being presentable. On another note: I'd really like to hear your thoughts on DI/IOC. For instance, it would be useful to mock out the exchange when testing brokerage classes, and I expect this is something you've already looked into.
James Smith
My last comment is outdated already. Migration is done. Merged with latest upstream. For the time being, referencing Moq for some unit tests. Alpha testing and live trading has started with a potential release build.
Jared Broad
Awesome James! Thanks for the updates. Please keep us in the loop! If possible please submit a PR for the crypto.io toolbox project. I'm sure lots of users will be interested in backtesting on bitcoin data.
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.
James Smith
I should be able to cherry pick the tick data downloader sometime soon. I'm tempted to just PR the whole Bitfinex branch as it's now been quite extensively tested. The only noteworthy thing missing relates to the margin call behavior, which is completely different to the SecurityPortfolioManager. You can just ignore the margin call requests at algorithm level, but this is a less than ideal solution. I'm undecided whether to hold back the PR until I have a complete and highly polished version or instead run with the current build that is functional but with known omissions.
Michael Handschuh
It may make sense to submit the PR now and allow for some review/feedback on the code. While the review is in progress, maybe we can implement an IBrokerageModel for bitfinex would could serve up the proper custom margin model.
James Smith
Agreed. I'm really keen to get started on ironing out the wrinkles and I'm open minded about the most appropriate way to extend Lean. In terms of the margin call behavior I was expecting to need to override
SecurityPortfolioManager.ScanForMarginCall
and generate warnings/requests when appropriate. The real problem here would be injecting the derived class without overriding several other areas. As I said I'm open minded on this issue.James Smith
James Smith
Zhengjun Zhou
Just want to know that is bitfinex can be used on QC cloud now?
Alexandre Catarino
We have deployed yesterday (Dec 18th, 2018) the new images in the servers to enable live trading with Bitfinex (and Alpaca). It is now in final tests before we can make it available. We will make an announcement in the forum when it is ready to be used and, hopefully, it will be our Christmas' gift to the community.
James Smith
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!