Paper Trading with the Alpaca API

Поділитися
Вставка
  • Опубліковано 5 жов 2024
  • In this video, I place stock orders using Alpaca, a commission-free trading API. I use Python and the requests package to make HTTP requests.
    For more tutorials, subscribe to this channel and follow me:
    Buy Me a Coffee: buymeacoffee.c...
    Twitter: / parttimelarry
    Website: hackingthemark...
    Source Code: github.com/hac...

КОМЕНТАРІ • 83

  • @uguruygur613
    @uguruygur613 2 роки тому +7

    Great video, Larry. Something your viewers may want to be aware of: I started using Alpaca given their promise of zero commissions. After learning their API and trading with them for months, suddenly they told me I was categorized as a non-retail investor and they would charge me fees. Very large fees...more than half of the profits I make in a good day. They didn't seem to care for an explanation either. When I protest, they point me to the fine-print, which practically says they can change their mind any time and start charging fees. So, don't necessarily trust them when they say zero commissions.

    • @parttimelarry
      @parttimelarry  2 роки тому +1

      Thanks, there have definitely been some changes since this video was made. The market data API was $9 a month when I covered it earlier this year, and is now $99 a month. I do think it's a great API if you are building an app or an investment business like composer.trade.

  • @Cyborg571
    @Cyborg571 5 років тому +28

    What a champ. This guy really knows his stuff!

  • @RoBearTheBrave
    @RoBearTheBrave 8 місяців тому +1

    Part time Larry, Full time Awesome! I was struggling with the api for 2 days, and kept getting a response of forbidden, but now I'm actually connecting. Thanks for the clear and concise content. Larry is the homie.

  • @Hermes3great
    @Hermes3great 4 роки тому +9

    I’m a week into learning Python.. you my friend are simply amazing! Please upload more content when you have time

  • @etai321
    @etai321 4 роки тому +10

    You sir are underrated... keep up these alpaca coding videos pls

    • @parttimelarry
      @parttimelarry  4 роки тому +1

      Thanks! More coming over the holidays!

  • @brettford7521
    @brettford7521 4 роки тому +3

    You are awesome to watch, thank you for trying out Alpaca for us. Algorithmic trading has been a goal of mine for a long time. I hope to be this skilled one day

  • @hpssskkk
    @hpssskkk 4 роки тому +5

    Great job! Your instruction is always easy to follow. Thought it will work for Australian Stock, but actually for US residents only. But do enjoy the paper trading. Thanks Larry

  • @ownagejuice1394
    @ownagejuice1394 4 роки тому +10

    thanks , just discovered Alpaca yesterday, this vid was cool. more Alpaca tuts

  • @jasoncysiu
    @jasoncysiu 3 роки тому +2

    Thank you Larry for all your amazing works! This channel is gold-mined!

  • @mschuer100
    @mschuer100 4 роки тому +2

    This is fantastic. Please do part 2. Amazing job

  • @TreasureCorals
    @TreasureCorals 2 роки тому +2

    Great video and solid programming skills, well done.

  • @JeJe-gx2pb
    @JeJe-gx2pb 4 роки тому +4

    nice api, thanks for pointing out. I think you can do r.json() rather than json.loads(response.content)/saves you the imports...

  • @breakoutgaffe4027
    @breakoutgaffe4027 2 роки тому +1

    Thanks a million Larry

  • @TKD187
    @TKD187 3 роки тому +1

    I need a friend like this just about everything he is doing is hurting my head I'm so lost but I'm very interested in learning how you do all of this

  • @k2icc
    @k2icc 4 роки тому +1

    Great tutorial for dummies. I had to try and try until finally got it. Horrible typos from my part, but again, great tutorial. I can now test on Paper Money. Thanks a lot.

  • @antoniodejesuscamposrodrig5250
    @antoniodejesuscamposrodrig5250 4 роки тому +4

    Nice! Exactly what I need at this moment!

  • @wallstreetpapi
    @wallstreetpapi 2 роки тому +1

    Thank you Larry!

  • @prod.kashkari3075
    @prod.kashkari3075 2 роки тому +1

    Hey could you zoom in a bit next time? Great video!

  • @natekennedy1668
    @natekennedy1668 3 роки тому +1

    great video! it helped me out a ton with a project I'm working on. keep it up!!!

  • @guillorama
    @guillorama 4 роки тому +1

    Great video! Got me up and running in no time

  • @buuusyleung
    @buuusyleung 2 роки тому +1

    Thank you very much.

  • @markliu22
    @markliu22 4 роки тому +3

    So clear, great vid!

  • @kaidenbunnell5921
    @kaidenbunnell5921 3 роки тому

    Weird that I recently got interested into coding and stocks at the same time, didn’t know they correlate like this.

  • @eddie_writes96
    @eddie_writes96 2 роки тому +1

    Thank You!!!🙌

  • @magicjim2007
    @magicjim2007 4 роки тому +1

    Excellent Tutorials!

  • @danimal777z
    @danimal777z 4 роки тому +1

    Great stuff!!! Could you do a video on how to create a sell order the same way? An alert from TradingView triggers a sell order for all shares of the stock symbol message ticker . Thank you!!!

    • @parttimelarry
      @parttimelarry  4 роки тому

      Did you see the other video in the channel on TradingView alerts and alpaca? That should do what you want, but been thinking of recording a variation that uses a VPS instead of Lambda.

  • @TKD187
    @TKD187 3 роки тому +1

    When I was signing up it wanted every single bit of my information my social security number everything it didn't do that with him I'm not giving any website that I don't know my social security number

    • @parttimelarry
      @parttimelarry  3 роки тому

      Every brokerage will get your info for tax purposes. You are right that it is a newer brokerage, but many of the established older companies don't have API access or they are hard to program.

  • @CapBuggy-zj5ml
    @CapBuggy-zj5ml 3 роки тому +1

    the get_orders() function is not working well, when I called it, return an empty list. how to solve this?

  • @plusk343
    @plusk343 2 роки тому

    10:38 , you can directly do response.json()

  • @trainspotting02
    @trainspotting02 4 роки тому +3

    Brilliant!

  • @cunningham.s_law
    @cunningham.s_law 3 роки тому +1

    no fees? how do they make money?

  • @mikkelbdker9413
    @mikkelbdker9413 4 роки тому +3

    Part 2, please!

  • @alejandrorosales2863
    @alejandrorosales2863 4 роки тому +1

    Thank you!!

  • @mattytrades799
    @mattytrades799 4 роки тому +4

    Did they Change the way for the API key ? Getting (venv) C:\Users\MATT\PycharmProjects\AutoTrade>python Trade.py
    b'{"code":40110000,"message":"access key verification failed : access key not found (Code = 40110000)"}'
    I'm not to sure what I"m missing .

    • @eukaryotic0703
      @eukaryotic0703 4 роки тому +1

      I have the same output.

    • @gottipolu33
      @gottipolu33 4 роки тому

      I am getting the same error. how did it get solved?

    • @nesrinefergani5318
      @nesrinefergani5318 4 роки тому

      @Matty Trades did you fix this problem , what should we do to fix it

    • @AlexJaeger716
      @AlexJaeger716 4 роки тому

      spoke to alpaca, they told me u need to fund your live account before you can get live data for paper trading/live trading. once u fund the account this error should go away..

  • @mecaelgetachew8990
    @mecaelgetachew8990 4 роки тому +1

    great video!

  • @nwgguy1070
    @nwgguy1070 3 роки тому

    Nice video, very helpful. Will be checking out some of your other vids, also. BUT -- PLEASE TURN OFF THE AUDIO IN THE NEXT ROOM! IT'S ANNOYING!

  • @nikhilkash92
    @nikhilkash92 3 роки тому

    Hi! Larry. I have a requirement. I am a high speed scalper using hotkeys to get in and out of the trade. My current setup is that i have pre-filled orders ready to be fired like the Qty,MKT/LMT order, etc... for example. if i want to buy 500 shares of an instrument at limit price with offset of + or - 2 cents i hit Ctrl+B. Also i have hotkeys for exiting the position like Ctrl + S to liquidate 50% of my position. Can i program something like this using python? If so can you please make a video on that?

  • @rizaacikgoz
    @rizaacikgoz Рік тому

    Hello Larry, is there any possibilities for connect tradingview to alpaca for our signal alert for spot and margins ? i watched your video but you define json file everytime if possible ı want to see video ıf possibe

  • @sgfreak96
    @sgfreak96 2 роки тому

    I'm not sure why, get_orders worked for me when I initially set this up, but now it does not return anything when I run the program. I set it up using this tutorial roughly a month ago and wanted to get into your next videos but tested the existing program and now nothing happens. I verified the api keys haven't changed and there aren't any errors which is weird.

  • @ccr6942
    @ccr6942 Рік тому

    Can Alpaca be used to scan the stocks too? I am talking custom coded scans not pre-made scans like trade ideas.

  • @adamsocki
    @adamsocki 4 роки тому +1

    Can you show what is inside your Config.py file?

    • @jsr7599
      @jsr7599 4 роки тому

      He can but it's sensitive, which is why he hid it lol.
      He created sample_config.py, to show you the structure/format

  • @oliverforsyth3411
    @oliverforsyth3411 4 роки тому +1

    hey man, love your content any way to contact you? I had a look at your git and website but no contact? I have a query perhaps you could help with?

  • @enterprisecloudnative8757
    @enterprisecloudnative8757 4 роки тому

    You don't have to pass in symbol = symbol, price=price man. Pass in a dictionary and then unpack it using **.

  • @hotspring9973
    @hotspring9973 4 роки тому +2

    pls code link

  • @justinjoseph129
    @justinjoseph129 4 роки тому +1

    What is the python IDE you are using? Thanks.

  • @MontagueFlips
    @MontagueFlips 4 роки тому

    Anyone know what this mean made 3k and when I tried to close the position i got this ,and when I woke up this morning my order was canceled ! On trading view I get the a “Broker incorrectly implements API” everytime I try to close a trade

  • @mohamedsumare1765
    @mohamedsumare1765 3 роки тому

    Is alpaca live trading accessible in Sierra Leone(Africa)

  • @kushalpai7411
    @kushalpai7411 3 роки тому

    Hey how could I make this program with a GUI

  • @apostolosnoulas2369
    @apostolosnoulas2369 4 роки тому

    i am 2 weeks into learning python, so obviously i have a long way to go and do not understand everything in the video, do you have any recommendations for any online document or course someone like me would take to learn to make trading algorithms?

  • @rajjohri8547
    @rajjohri8547 3 роки тому

    Hey Larry why do you prefer the standard requests over the python wrapper?

    • @parttimelarry
      @parttimelarry  3 роки тому

      I don't, this video was made a couple years ago and I recorded it a couple hours after I heard about Alpaca on twitter. I think this was pretty early on, so the Alpaca python package was earlier in development and may have had an issue, so just used endpoints directly. There was also a time right after the bracket order feature was enabled where you could use the endpoints directly but it was not yet part of the python package for another week or two.

  • @AmazingHD
    @AmazingHD 4 роки тому

    What is the advantage of alpaca compared to other APIs? i dont get it.

    • @parttimelarry
      @parttimelarry  4 роки тому +4

      What is your favorite commission free trading API? Would love to make videos on some others. In the previous video I used the Robinhood private API, but the drawback there was that is isn't official or supported and could change anytime. The others I have tried were more difficult to get started with (Ameritrade) or had high commission fees at the time. Do you have any recommendations? Thanks!

  • @louisrazo7070
    @louisrazo7070 4 роки тому

    do you have a git hub repo for alpaca?

    • @parttimelarry
      @parttimelarry  4 роки тому

      Just started it, will be pushing source code to github.com/financehacks

  • @Johnny_B_Goode
    @Johnny_B_Goode 4 роки тому

    Nice! But I follow it and get this error!??! code":40110000,"message":"access key verification failed : access key not found someone know why?

    • @parttimelarry
      @parttimelarry  4 роки тому +2

      Seems like your Alpaca API key and secret may be missing or incorrect. When you generate a new one, it deletes the old, I've run into that before as well.

    • @nesrinefergani5318
      @nesrinefergani5318 4 роки тому

      Did you fix this problem? I have the same output , can you tell me what should I do to fix it please?

    • @AlexJaeger716
      @AlexJaeger716 4 роки тому

      spoke to alpaca, they told me u need to fund your live account before you can get live data for paper trading/live trading. once u fund the account this error should go away..

  • @dimayasnohurskyi2805
    @dimayasnohurskyi2805 4 роки тому

    You can't use paper trading because without funding account, polygon API KEY not supported. Game over)

    • @parttimelarry
      @parttimelarry  4 роки тому +3

      Yeah I created a real account too and have keys for both real and paper trading. From reading the Alpaca docs, they say it doesn't have a minimum deposit. So game on :)

    • @dimayasnohurskyi2805
      @dimayasnohurskyi2805 4 роки тому

      @@parttimelarry but only for US residents :-(

  • @aurelioulloa09
    @aurelioulloa09 3 роки тому

    I WILL PAY SOMEONE WHO HELP ME TO BUILD A BOT TO TRADE

    • @dankeyote5873
      @dankeyote5873 3 роки тому

      i can help you if you still need one..

  • @double_j3867
    @double_j3867 4 роки тому

    How do these free trading platforms make their money? #Suspicious....

  • @orhancoskun8193
    @orhancoskun8193 3 роки тому

    I copied your code, but I am getting b'{"code":40110000,"message":"access key verification failed : access key not found (Code = 40110000)"}' error. Please help