How to Code a Bitcoin Bot in Python - Machine Learning Tutorial

Поделиться
HTML-код
  • Опубликовано: 22 сен 2024
  • In this video, you will learn how to create a cryptocurrency trading algorithm that uses machine learning to make trading decisions. We will develop a neural network to predict Bitcoin's price direction. Besides Bitcoin, you could also use this tutorial for other cryptos, stocks, forex, or whatever else you want to trade.
    Create your free QuantConnect account: www.quantconne...
    (This is a referral link)
    Clone the code from this video: www.quantconne...
    Support me on Patreon: / tradeoptionswithme
    Check out my Full Algorithmic Trading Course: • Full Algorithmic Tradi...
    3Blue1Brown introduction to neural networks: • But what is a neural n...
    Sentdex introduction to deep learning with Python: • Deep Learning basics w...
    QC Machine Learning docs: www.quantconne...
    Follow me on:
    Facebook: / tradeoptionswithme
    Twitter: / louis_options
    Pinterest: / louistradeoptionswithme
    Instagram: / tradeoptionswithme

Комментарии • 63

  • @CaptainOfBay
    @CaptainOfBay 2 года назад +6

    Another great video. Real gems for aspiring algo traders. please continue. Thank you for your work

  • @TradeOptionsWithMe
    @TradeOptionsWithMe  2 года назад +3

    You can clone the code from this video here: www.quantconnect.com/forum/discussion/13141/introduction-to-machine-learning-using-neural-networks-and-bitcoin-video-tutorial/p1?ref=towm
    Note that you first need to run the code in the research notebook to be able to backtest the algorithm.

  • @olivierblokhuis8137
    @olivierblokhuis8137 2 года назад +19

    I love this video, could you make more machine learning video’s in the future? Thank you!

  • @evanlightner
    @evanlightner Год назад +1

    This is incredible stuff. Looks like we can implement Scikit Learn too for further improvements to our QC algo models. Can't thank you enough for this content.

  • @antonkiselev7768
    @antonkiselev7768 2 года назад +9

    Very interesting example, thank you. I have been working with multiple time-series ML/DL libraries and built many models, however as I understand, one of the key issues is related to re-training the model constantly. Ideally, if we are doing daily predictions, we would want to re-train the model daily - so we get latest data points (and in many models they would be considered more important). Testing it is also extremely difficult - you would need to do a re-training every time you get new datapoints (there should be a rolling window) or schedule a regular re-train. And you can imagine that if we are creating a Universe in Quantconnect we will need to multiply our efforts by the number of symbols ( So basically when you have a testing period of a year (365 days) and you forecast 1 Day into the future, you would need to have a similar number of re-trainings. Otherwise if we train the model once at the beginning of the year, its performance would be worse and worse the further we go from the training set last date.

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +2

      Thanks for the comment. That is a good and interesting point, thanks for sharing.

    • @antonkiselev7768
      @antonkiselev7768 2 года назад +2

      @@sirens367 I wish...It is one of the key issues with time series - constant need to re-train. Many forecasting ML/DL models are focused around recent data changes. Imagine if you build a model to predict Tesla stock price for next 7 days, but your model was trained based on 2010-2020 data - do you really believe that even if the model was good during 2020, it will still be good for 2022? You can look at TSLA ticker chart to see the point. It is one of the reasons why I dropped using heavy Deep learning (GPU based) models and switched to more mathematically simplistic automated trading strategies - too much computational power needed, too difficult to easily scale and test.

    • @rupindersingh1312
      @rupindersingh1312 Год назад

      @@antonkiselev7768 which types of mathematical models are u currently using ? Kindly share

    • @Arstotzka
      @Arstotzka Год назад

      ​@@antonkiselev7768 I was thinking of a portfolio construction model that allocates position size taking into account the time the alpha model was trained for each insight. Maybe that can help distrubute the training runs, instead of re-retraining all models each day, train a certain quantity and limit the leverage of the others? It's far from a solution but I think it may be worth giving a shot.

  • @anthonyharrison7395
    @anthonyharrison7395 2 года назад +6

    great video

  • @yolow5497
    @yolow5497 2 года назад +3

    would be cool if u could show how to use keras tuner to improve the network structure

  • @BitStreamTR
    @BitStreamTR Год назад +1

    Thank you for your awesome videos! I am new to coding and I really enjoy how you explain things...

  • @TradeOptionsWithMe
    @TradeOptionsWithMe  2 года назад +3

    To learn everything you need to know to get started with developing your own trading algorithms, check out my free course: ruclips.net/p/PLtqRgJ_TIq8Y6YG8G-ETIFW_36mvxMLad

  • @bigfranchise
    @bigfranchise Год назад +1

    Do you offer a service to program a trading strategy?

  • @gracia9775
    @gracia9775 2 года назад +2

    Thanks a lot ! Your channel is awesome, thanks for sharing !

  • @revilo7267
    @revilo7267 2 года назад +2

    Very cool, but I thought you were going to let it run the sample data over and over again until it was performing well and predicting the market with a higher win rate percentage each time, isn't that the whole point of machine learning?

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +2

      That’s basically what I did, but if you do this too often, you run the risk of overfitting it to the training data.

  • @folashadeolaitan6222
    @folashadeolaitan6222 2 года назад +1

    Thank you for the knowledge. Please i have the following questions.
    1). I would like to add some indicators (e.g ATR, RSI, MACD etc) to my dataframe to be used an input into the neural network mode. Do you advice these are added before taking the % change of the OHLC values or after? Do I also need to apply the pct_change () on these indicator values or just on the prices?
    2). Assuming i have an already trained and saved model, how can it be imported into Quant connect to be used for building the bot?
    3). Do you advise a data normalization, especially after taking the % change of the OHLC and adding indicators?

  • @410matti
    @410matti 2 года назад +1

    Great tutotrial! thank you so much for your effort. Are you evaluating the possibility for a video about Reinforcement learning algorithm?

  • @ouiken
    @ouiken 2 года назад +1

    what's your accuracy percentage? what currency did you test this under ?

  • @folashadeolaitan6222
    @folashadeolaitan6222 2 года назад +1

    Could you pls also briefly explain how to interprete the backtest report; the sharpe ratio and co. Thank you

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +2

      Check out my free algorithmic trading course on my channel, there we cover this in detail in one of the lessons.

    • @folashadeolaitan6222
      @folashadeolaitan6222 2 года назад

      @@TradeOptionsWithMe On the lesson series now, thank you so much sir.

  • @telifhakki8745
    @telifhakki8745 Год назад

    When I select the time range between 2021 and 2022, why does it generate the result of old dates in the analysis results? By the way, my account is free, but my analysis is super, so thank you also. :)

  • @frosbee6344
    @frosbee6344 2 года назад

    Hi does the program not require block chain ?
    Also like your work. Thanks for sharing .

  • @busragert
    @busragert Год назад

    thanks for great video. I have a question. 9:59 should the optimal value be 50?

  • @xnoxgene7997
    @xnoxgene7997 2 года назад

    Thanks! Very interesting! Get a question though, why the backtest result of same timeframe could be significantly different every time? even I haven't change anything on the model itself after it was once saved as object to the ObjectStore? I mean most backtest run was -ve return but vary from -85% to -50% and one was +ve return. Am I missing something?

  • @TuanLe-qf7om
    @TuanLe-qf7om 2 года назад

    By following your guide, I'm able to get the code work successfully. However, when I changed resolution from Daily to Hour, I finished running model, but when backtesting, the test ran for a short time, until it stopped due to the Error: Error when checking input: expected dense_input to have shape (30, 5) but got array with shape (29, 5) at standardize_input_data. I expect there was something wrong with the data got from coinbase. How can I fix this problem?

  • @millerkronk9873
    @millerkronk9873 2 года назад

    Are your trained weights also being saved to the ObjectStore?

  • @blockcrypto9108
    @blockcrypto9108 2 года назад +2

    Hello TradeOptionsWithMe!
    Awesome video, one question; in 12:56 the neuralnetwork will overfit itself if you have too many epochs. Why is that? Since you want the model to adjust itself to the data so it's better prepared for unknown data right? So I don't really understand why you would only want it to run 5 times and not say 20.

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +2

      The more epochs you run, the closer the model will fit itself to the trading data. The goal is that the model learns general patterns existent in the data, but we don’t want it to learn the actual data. You have to remember that we don’t want the model to be perfect at predicting the training data, it has to be able to perform well on their data as well.

    • @blockcrypto9108
      @blockcrypto9108 2 года назад +1

      @@TradeOptionsWithMe Thanks for the quick answer!
      Another question I had: would it be possible to give the Neuralnetwork another input layer in the form of an indicator? Like the ATR or the RSI for example. So it combines the values of the indicator with its standard non indicator output to generate an multi disciplined output? I'm very new to coding in general and have never tried machine learning but it's a lot of fun, so sorry for the noobish question haha.

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +2

      @@blockcrypto9108 No worries about the questions. You can easily add more input variables to the neural network by adjusting the input shape. There is no need to add an extra layer for this. But in general, you can also add more custom layers to the network if that's what you want.

    • @blockcrypto9108
      @blockcrypto9108 2 года назад +1

      @@TradeOptionsWithMe Okay cool! I will try and implement that. Also one question about the training for the neural network in this code.
      In ln(8) it says the following:
      train_length = int(len(features)*0.8)
      X_train = features[:train_length]
      X_test = features[train_length:]
      y_train = labels[:train_length]
      y_test = labels[train_length:]
      sum(y_train)/len(y_train)
      Does this mean that the training will be done for 80% of the whole testing data defined in ln(2) by date time? And that the testing will be done on the 20% that's left?

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +1

      Yes, that’s right. We use 80% of the data for training purposes, and the remaining 20% for testing.

  • @HalkerVeil
    @HalkerVeil 2 года назад

    How would you link this to a coinbase api?

  • @museumfinds9511
    @museumfinds9511 2 года назад +1

    Just a quick question, do you need money to make this?

  • @410matti
    @410matti 2 года назад +1

    Grazie.

  • @miraclelawrence7140
    @miraclelawrence7140 6 месяцев назад

    Did not work. kept throwing errors

  • @coSmic_nirVana
    @coSmic_nirVana 2 года назад

    Getting an error stating object has no attribute while backtesting the clone, please assist

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +1

      Have you used the link in the description box to clone the code? Also did you first run the code from the research notebook?

  • @lordofsenpai8769
    @lordofsenpai8769 Год назад

    Great Video, helps alot, but I got an error, which I can't fix. It says "ValueError: cannot convert float NaN to integer", and its at the last part in the Jupyter Notebook file. it probably cannot read the "Down" and "up" as it should, or it tries to convert it to a float. Can you help me with that?

    • @iamsirprize
      @iamsirprize 8 месяцев назад

      did u get any solution to this problem... also facing the same issue

  • @danielsckarin574
    @danielsckarin574 2 года назад

    Building a profitable trading bot is harder than you think. It is not enough just to be a good software engineer you also have to be a good trader with many years of experience.

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +4

      It is true that you should have good software engineering as well as trading knowledge, but profitability is not really a good way to measure whether a bot is "good". Just creating a profitable bot is very easy since you could just make it buy and hold some market index.

    • @danielsckarin574
      @danielsckarin574 2 года назад +1

      @@TradeOptionsWithMe Sure, I mean exactly that, building a bot which will outperform market it's a real challenge.
      Thank you for your option trading strategy for the range market. It was really useful.

  • @HITthegymwithjkhman
    @HITthegymwithjkhman 2 года назад +1

    👍🏽

  • @antoniocincottiserafini9517
    @antoniocincottiserafini9517 2 года назад

    Is there a tutorial that explains this a simpler way?

  • @andreialcaza
    @andreialcaza 2 года назад +1

    I get error

    • @TradeOptionsWithMe
      @TradeOptionsWithMe  2 года назад +1

      Have you used the link in the description box? If so, have you run the code from the notebook first to create the actual neural network model?

    • @mohdarman7957
      @mohdarman7957 2 года назад

      @@TradeOptionsWithMe sir can you please make tutorial how can be add this code in our website to prediction

    • @mohdarman7957
      @mohdarman7957 2 года назад

      @@TradeOptionsWithMe please it's really helpful for me 🙏 I'm not a master but I want to create it and help to all beginners

  • @clintedwards5664
    @clintedwards5664 Год назад +1

    Dude lol you need to get a quieter keyboard this is like ASMR STUFF lol and I can’t stand that sound lol

  • @savire.ergheiz
    @savire.ergheiz Год назад

    Pfft crypto space too many fake out this ML shyte will cause you loss of money faster than you can change your codes 😁

  • @gatomeawscle4242
    @gatomeawscle4242 6 месяцев назад +1

    BORING