Coinbase Advanced Trade API: Recurring Buys Tutorial

Sdílet
Vložit
  • čas přidán 29. 08. 2024

Komentáře • 97

  • @Ppl4872
    @Ppl4872 Před rokem +1

    Thank a lot Rhett! Your tutorials on setting up a bot on gemini helped me a ton in the past. So glad to see you provided another one for coinbase advance trade - super helpful. Highly recommend to my fellow crypto trading beginners' community!

    • @RhettReisman
      @RhettReisman  Před rokem

      Glad to help - deposit / withdraw script will be out tomorrow :)

  • @jimreitz768
    @jimreitz768 Před rokem

    I think it's amazing that I was just looking for this video, and you published it 9-hours ago. What great timing! Looking forward to the withdraws part!!! i don't keep crypto on exchanges anymore! Thanks Rhett!😃

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Haha perfect timing! Definitely don’t leave crypto on exchanges 🧠 Cheers Jim!

  • @DrinkTheCoolaid8484
    @DrinkTheCoolaid8484 Před rokem

    Great! Thank you Rhett! I had the limit buy vs market order question in the back of my head, thanks for teaching us how to set up the auto limit orders! I will spread the word and share your video with anyone that wants to set up auto orders! Cheers !

    • @RhettReisman
      @RhettReisman  Před rokem

      Thank you! 🙏🙏 Let me know if you have any questions :) glad to help!

  • @PrettyPinkPansi
    @PrettyPinkPansi Před rokem +1

    The code is correct in the video but incorrect in the link in the description. In the link it has a python lambda function which looks very similar to your code but does the opposite.
    factor = .998 if my_side == Side.SELL.name else 1.002
    This returns .998 for sell and 1.002 for buy
    In the video you have:
    factor = .998
    if my_side == Side.SELL.name:
    factor = 1.002
    Thanks for the great video!

    • @RhettReisman
      @RhettReisman  Před rokem

      Good catch, thank you 🙏 I ran it through ChatGPT to "optimize" and didn't catch that error. So much for AI haha 🤦🏻‍♂️
      Updated it now to "factor = .998 if my_side == Side.BUY.name else 1.002" which I think should work

  • @anurav9434
    @anurav9434 Před rokem

    Thanks for posting. Big help. Made some minor changes. Played around with the API Key settings, needed just the BTCWallet and USDWallet and very few permissions like create Order, Transactions etc.. also set the limit factor to 0.995.. It looks good. Thanks again

  • @jzizka
    @jzizka Před 9 měsíci

    Great video. I would advise against allowing blindly all rules. The documentation says you only need wallet:buys:create, wallet:user:read for creating orders. I also feel better putting my key and secret phrase to enviroment variables out of the code in case i ever want to share it.

  • @rkondeti3
    @rkondeti3 Před 8 měsíci

    This was awesome and easy to follow along, thanks!

  • @devanteswing1825
    @devanteswing1825 Před 8 měsíci

    Hi Matt - love the video and would love to see a recurring bank deposit/withdrawal video.

    • @RhettReisman
      @RhettReisman  Před 8 měsíci

      Here ya go! czcams.com/video/0FvnTtbz4cA/video.htmlsi=ynwspNowQTlr2wAN

  • @MrAdamGershon
    @MrAdamGershon Před rokem +1

    Hey Rhett, thanks for the tutorial! Super easy instructions. One question: Do you need to have USD already in your Coinbase account for these transactions to execute, or does this script add funds for you? I know with Advanced Trade you need to add funds before you can do limit orders so I wasn't sure if that was something that was done automatically by this script.

    • @RhettReisman
      @RhettReisman  Před rokem +2

      Yeah you need USD already in the account for these trades to execute, I'm working on something to automate deposits and withdrawals (for now you'll need to manually deposit, but should have a video on deposits/withdrawals in the next month). We were able to do it with Coinbase Pro so I'm assuming it will be possible with Advanced Trader too.

    • @cactusarray
      @cactusarray Před 11 měsíci

      @@RhettReisman Did you ever figure out a way to automate deposits into Advanced Trading?
      Edit: Found it! czcams.com/video/0FvnTtbz4cA/video.html

  • @davegardner5246
    @davegardner5246 Před rokem

    Amazing video. Works perfectly. Thanks very much.

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Happy to help :)
      Big stuff w Coinbase api coming soon

  • @masv1995
    @masv1995 Před rokem

    Great video Rhett! Just curious, what platform do you currently use for recurring buys? And why?
    Also, what schedule do you use? Daily? Weekly?

    • @RhettReisman
      @RhettReisman  Před rokem +2

      Using Strike for monthly large buys and Coinbase daily small buys
      Talked about it in this video: czcams.com/video/zysi14QAfh0/video.html

  • @socerbeast9
    @socerbeast9 Před 5 měsíci

    this is gold. thank you

  • @Juancho90210
    @Juancho90210 Před 4 měsíci

    Stumbled across this video and this is perfect for my DCA use case. I have a dumb question since I know nothing about coding, so apologies in advance. I saw that there were revisions made to the code compared to the one you show in the video. Are the steps in the video still accurate with the current version of the code? Thanks

    • @RhettReisman
      @RhettReisman  Před 4 měsíci +1

      Steps in this video are still accurate - over time I’ve edited and written new code that I think is easier to implement but without coding experience your results may vary
      My goal is to make sure these videos original solutions still work though as far as that is in my control (AWS / Coinbase UI might change)
      Playlist of all my Coinbase api stuff is here: czcams.com/play/PL-p_L_HbK7jX-gaykD-E8mTN2X4Yxc4Rd.html&si=CMVLR0Mc7bcTokY6

    • @Juancho90210
      @Juancho90210 Před 4 měsíci

      @@RhettReisman Also, were you able to figure out which permissions were the only that were only necessary for this API or have you just left it on all?

  • @christophermorris486
    @christophermorris486 Před rokem

    Love the videos man! I DCA into BTC/ETH daily. Would you recommend 2 instances of the code for each or is it more optimal to add some lines to handle both orders in one shot?

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Better to do this process twice in my opinion so that you can run them on separate schedules and disable one coin if you don’t want to DCA it anymore.
      If you’re not interested in that though feel free to do it all in one

  • @adog12335
    @adog12335 Před rokem

    you are a genius

  • @marty590
    @marty590 Před rokem

    Great video Rhett.

  • @mattlaurabullard5115
    @mattlaurabullard5115 Před rokem

    Thanks so much for this, works perfectly! I do DCA (BTC-GBP) on Coinbase AT, and as BTC-GBP is less liquid than the BTC-USD market used in the video, I find that the .999 factor in the code creates a buy order that is too far from the market price and so it can take a long time to fill. I sometimes watch as my order fails to fill and the price rises and rises away, but I'm without a position to sell and take advantage of the price rise, because that day's DCA buy order hasn't filled! Eventually the price falls and my buy order fills, but by then I've missed an opportunity to make a little profit. HOWEVER, I have simply amended the factor in the code to .9995 and am finding that lists an order much closer to the market price, but still slightly under so I get the maker fee, and it fills much more quickly! One further automation that I'm struggling to find advice on, is whether there is a way to look up your last buy and list a limit sell for the same amount of BTC but at a price that is X% higher than I paid for it? Seems like something that MUST be possible, but I can't figure it out/find any examples - can anyone help?

    • @RhettReisman
      @RhettReisman  Před rokem +2

      Definitely possible. I haven’t built it out yet. There should be a way to query every order you’ve made. If you have other examples of trading strategies you’d like built I’m going to make another API on top of this one that makes it easier to do. Thanks for the great feedback :)

    • @mattlaurabullard5115
      @mattlaurabullard5115 Před rokem

      @@RhettReisman Thanks for the reply, would be amazing if you could do that! The only other automation I'm currently looking for is automated deposits/withdrawals that are triggered IF a balance is above/below a certain level e.g. so I can automatically scurry away any excess GBP into my much safer (and interest paying!) UK bank account rather than leaving it in Coinbase , but also that I ensure there is always just enough GBP in my Coinbase account to service my DCA recurring buys... e.g. if a BTC sell order fills and I now have £50 in my Coinbase account, an auto withdrawal API withdraws £40 to my bank account leaving £10 available in Coinbase for tomorrow's recurring buy. Similarly if at a specified time my Coinbase GBP balance is insufficient to place my next DCA recurring buy, the API will automatically deposit from my bank account whatever I need to ensure I have sufficient GBP to place the buy order. Basically: withdraw any balance over £10, and if the balance is under £10 then deposit whatever is needed to bring it up to that value. Make sense? Doable?

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Yeah that makes sense. Very doable! I’ll add that to the list. If you come up with more ideas please add them here or dm me on Twitter @rhettre (I’ll probably see it faster over there)

  • @xshooter03
    @xshooter03 Před rokem

    Thank you for another great video. Can you also do a video on coinbase direct deposit. They claim direct deposits into crypto currencies are free of trading fees but they add a spread and don't specify how big is the spread.

    • @RhettReisman
      @RhettReisman  Před rokem +1

      I'll try to look into it - in my experience it's really hard to tell what the spread is on direct deposit products if the company doesn't provide you the information.
      That being said - if they're not advertising the spread or giving you the info after you run a direct deposit, I can't imagine the spread is very competitive. If it was really low I'm sure they would want to advertise it as much as possible.

  • @dr.holiday
    @dr.holiday Před rokem

    Fantastic video Rhett, thank you very much! Have you created a video already on how to automatically send the Coinbase assets to a hardware wallet? That's my missing step in a fully automated & safe process 🙂

    • @RhettReisman
      @RhettReisman  Před rokem +2

      Glad to help doc :D
      I haven't figured it out yet - it looks like there's a way to do it using their /v2/ API but I've been having trouble connecting (been DMing with Coinbase engineers on Twitter actually haha their whole API system internally kind of seems like a mess right now). Hoping to get something out in April

    • @dr.holiday
      @dr.holiday Před rokem

      @@RhettReisman Cool! I'll stay tuned :)

  • @YarikSychov
    @YarikSychov Před rokem

    Good stuff man, thank you!

  • @RhettReisman
    @RhettReisman  Před rokem

    Have you used Advanced Trading yet? Do you like it more than Coinbase Pro?

  • @Afiore108
    @Afiore108 Před rokem

    Another good video

  • @theflybaby6736
    @theflybaby6736 Před 4 měsíci

    I was hoping for an update if possible. This functions can't work if you use a yubkkey. So I guess I have to use andvace trade API.

    • @RhettReisman
      @RhettReisman  Před 4 měsíci +2

      Advanced trades api should work with a Yubikey. Here’s a library I wrote if you need more functionality: czcams.com/video/Z0w_tb918K0/video.htmlsi=zBoPyPX-yY4CmTHO
      They recently changed the auth with new api keys im working on fixing it will have it out in May.

  • @johng6417
    @johng6417 Před rokem

    very helpful

  • @cashanks
    @cashanks Před rokem

    hey, Rhett. Thanks for your ongoing work. Do you know if the python code is encrypted on AWS? As in, are your keys secure from AWS support staff or hacks into AWS?

    • @RhettReisman
      @RhettReisman  Před rokem

      If your AWS account is hacked your keys would be exposed to the hacker (important to use 2FA - video here: czcams.com/video/rq_yYNAUQCg/video.html). Support staff shouldn't be able to go rogue and see your code but I'm not sure what Amazon's internal controls are - couldn't find any info on this.
      Here's a best practices article if you want to learn more: sysdig.com/learn-cloud-native/cloud-security/how-to-secure-your-aws-lambda-functions/

  • @lorenzobellucci9283
    @lorenzobellucci9283 Před rokem

    Can I leave the Lamba function running with the recurring event bridge even though I don't have money in the Coinbase account (I guess so)? So that whenever I decide to get back into DCA, my system is already setup? Or Does Lamba eventually stops the recurring triggers if multiple attempts to buy have failed? thanks

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Yes, the orders will just fail and when you deposit more money it will start again.
      The automation won’t stop unless you tell it to, it doesn’t know the difference between failing and succeeding.
      Probably don’t spam the API with orders you know are going to fail every 5 minutes or something like that but once a day is probably fine.

  • @jimreitz768
    @jimreitz768 Před rokem

    And how to convert my USDC to USD prior to the buy?

    • @RhettReisman
      @RhettReisman  Před rokem

      Thanks for the super 🙏
      If you check out the documentation here it looks like they haven't (yet - not sure if it's part of the roadmap at all) implemented the convert currency function from CB Pro. docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-pro-mapping
      Looks like you can still convert USD-USDC through the UI but programmatically I'm not seeing a simple way to do it (even though they say that USD and USDC wallets are "unified" placing a BTC-USD order won't pull from your USDC wallet). Also seems like through the UI you can place recurring buy orders for USD to USDC but no recurring sells from USDC to USD.
      I think the way to do this programmatically would be to take advantage of one of the three USDC trading pairs that seems available on the API (EUR-USDC, GBP-USDC, USDT-USDC). This is definitely suboptimal as you'll have to take multiple hops from USDC back to USD (ie. sell USDC into USDT, buy BTC with USDT, and then sell BTC into USD). You'll probably need to have some of those orders be maker as I imagine setting a limit order for USDT-USDC will be difficult.
      Sorry I couldn't really find a solution but hope that helps a little.

    • @Mr_Matt
      @Mr_Matt Před 3 měsíci

      you can just trade BTC-USDC to use your USDC rather than USD

  • @agolden24
    @agolden24 Před rokem

    can you do a video on how to double check if your ledger seed phrase actually works? Is the only way to do this to buy another hardware wallet and putting in the seed phrase? Or is there another way?

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Planning some videos showing how to restore a ledger from trezor etc
      Just to verify, there’s a recovery check app in ledger live: coinstop.io/blogs/blog/how-to-check-if-your-recovery-phrase-is-correct
      You could also send out most of your coins to some other wallet, reset the ledger to factory settings, and then restore from that seed phrase and send the coins back. Obviously this isn’t as good since if the phrase is wrong you’d lose whatever you left in the wallet.

  • @valee4387
    @valee4387 Před 6 měsíci

    is this coinbase API deprecated? I'm unable to create a key the way you do. I think they may be forcing us to use the coinbase cloud one which involves generating a jwt

    • @RhettReisman
      @RhettReisman  Před 6 měsíci +1

      Shouldn't be. I'm in the process of transferring the API over to Coinbase Cloud jwt will have video out soon

  • @jamesbest4372
    @jamesbest4372 Před rokem

    Have you looked into using the python cbpro library to add a layer of abstraction to the APIs? if so have you noted a change in %s for the cost to enforce a transaction?

    • @RhettReisman
      @RhettReisman  Před rokem

      Not sure I understand the question. The cbpro library won’t work for Advanced Trade because Advanced Trade is using different endpoints.
      I wrote a Python wrapper for Advanced Trade here: www.rhett.blog/coinbase-advanced-trade-api-python-wrapper/

  • @dioncone2128
    @dioncone2128 Před 18 dny

    When I attempt create an API key it the system no longer creates the API secret

    • @RhettReisman
      @RhettReisman  Před 15 dny

      They changed their authentication method. New tutorial:
      czcams.com/video/OIcZjOlEYKw/video.html

  • @gius_taakstudio
    @gius_taakstudio Před rokem

    neat! bravo n thanks

  • @bhoang927
    @bhoang927 Před rokem

    Is it possible in your next blog post on coinbase api you can include how to convert from usdc to usdvia api? I would like to keep my usd in USDC to capture the APR

    • @RhettReisman
      @RhettReisman  Před rokem

      I’m not sure it will let you auto stake the USDC to give you interest (or however it is generating interest) but I’ll look into it

  • @xDF666
    @xDF666 Před rokem

    Is there a way to automate one Lambda function to DCA into 10 currencies at once?

    • @RhettReisman
      @RhettReisman  Před rokem +1

      Yep just have one line creating a limit order for each coin. Maybe add a pause between each buy.

    • @xDF666
      @xDF666 Před rokem

      @@RhettReisman How would that look in the code? Is it an additional page for everything or can I use a certain section multiple times?
      Also for me only around 8 wallets are displayed creating the API, is there a way to add more?
      Thanks for the fast reply btw!

    • @RhettReisman
      @RhettReisman  Před rokem +1

      @xDF666 you would basically want 10 of these in a row:
      placeLimitOrder(my_side, my_trading_pair, my_order_size, my_limit_price)
      You could either make new variables for each currency (probably the right thing to do) or just write 10 of those lines that look like this:
      placeLimitOrder(“Buy”, “ETH-USD”,”.01”, “1000”)
      Again you’d probably want variables for the size and price like we already have. You might be able to throw the whole script into ChatGPT and ask it to rewrite it with 10 currencies and explain its changes.
      Hope that made sense. If there’s content I could make to help explain the programming fundamentally, let me know I’ve been trying to think of a way to teach the non-programming audience how to edit these scripts more effectively, but I’m not sure what specific things to cover in a video like that. Maybe a live stream would be more helpful.

    • @xDF666
      @xDF666 Před rokem

      ​ @RhettReisman Thank you very much!
      Considering your video on how to teach your non-programming audience to edit code you basically already gave me that answer with your ChatGPT advice.
      So the general content of the video could be on how to edit scripts with ChatGPT and maybe some prompts for it. Guess that would help a lot of people and its generally a good idea to produce AI content for your channel to grow.

    • @RhettReisman
      @RhettReisman  Před rokem +1

      @xDF666 Good idea, thanks :)

  • @jakegaraghty4977
    @jakegaraghty4977 Před rokem

    Great guide! Any idea where the cheapest place to buy LTC is? And do you have a Twitter?

    • @RhettReisman
      @RhettReisman  Před rokem +1

      @rhettre on Twitter: check this video for lowest fees (exclude strike and swan btc only): czcams.com/video/zysi14QAfh0/video.html

    • @jakegaraghty4977
      @jakegaraghty4977 Před rokem

      I wonder if there's a cheaper way besides exchanges since LTC is listed on many other places like ATMs, telegram, ect... Can't remember others

    • @RhettReisman
      @RhettReisman  Před rokem

      I think it’s very unlikely that any ATM or peer to peer has a better price than an exchange.
      ATM video here: czcams.com/video/rznBAUEdYIM/video.html

  • @themichaelmoreno1
    @themichaelmoreno1 Před rokem

    Hey Rhett, I don't see an API Secret when I view my API key?

    • @RhettReisman
      @RhettReisman  Před rokem

      Hmmm that's strange. Maybe try posting on the forums, sounds like it's a coinbase issue. I've never seen that before. forums.coinbasecloud.dev/

  • @coolmonkey619
    @coolmonkey619 Před rokem

    is coinbase the best exchange to do this automated buys

    • @RhettReisman
      @RhettReisman  Před rokem

      In my opinion yes. I did comparison of costs here: czcams.com/video/zysi14QAfh0/video.html

  • @RichardByrneUK
    @RichardByrneUK Před rokem

    Hi Rhett, would to be able to redo the code for IA's DCA on steroids to work for this new Coinbase Advanced please? Love your videos, thanks in advance(d) 😊

    • @RhettReisman
      @RhettReisman  Před rokem

      Probably won’t make another whole video for it but I can re-release code on the blog. Subscribe over there (and follow me on Twitter) for updates :)

    • @RichardByrneUK
      @RichardByrneUK Před rokem

      @@RhettReisman Yeah that'd be perfect, many thanks 👍

  • @vickychen543
    @vickychen543 Před 9 měsíci

    my API secret is not shown. It will be shown in 48 hours?

    • @RhettReisman
      @RhettReisman  Před 9 měsíci

      Yeah that can happen the first time you make an api key

  • @gius_taakstudio
    @gius_taakstudio Před rokem

    🙋‍♂def interest in the auto withdrawal to ledger sequel :)

  • @jakegaraghty4977
    @jakegaraghty4977 Před rokem

    Is strike still cheapest?

    • @RhettReisman
      @RhettReisman  Před rokem

      Yeah info should be up to date in the spreadsheet 👍