Giter VIP home page Giter VIP logo

go-robinhood's Introduction

Go Reference

Robinhood the rich and feeding the poor, now automated

Even though robinhood makes me poor

Notice

2022-05-24

Robinhood updated their API and our auth method broke. The new authentication requires using your email as your username, so if you see an error message about an invalid email, you'll need to update your username.

2018-09-27:

If you have used this library before, and use credential caching, you will need to remove any credential cache and rebuild if you experience errors.

General usage

cli, err := robinhood.Dial(&robinhood.OAuth{
  Username: "[email protected]",
  Password: "mypasswordissecure",
})

// err

i, err := cli.GetInstrumentForSymbol("SPY")

// err

o, err := cli.Order(i, robinhood.OrderOpts{
  Price: 100.0,
  Side: robinhood.Buy,
  Quantity: 1,
})

// err

time.Sleep(5*time.Second) //Let me think about it some more...

// Ah crap, I need to buy groceries.

err := o.Cancel()

if err != nil {
  // Oh well
}

go-robinhood's People

Contributors

andrewstuart avatar chenna-krishna avatar chennakrishna8 avatar drbh avatar mitchk avatar richardthelionheart420 avatar umpc avatar vayias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-robinhood's Issues

Fix url used in GetInstrument

"%sinstruments/?chain_id=%s&expiration_date=%s&state=active&tradability=tradable&type=%s",

There should be an "s" at the end of expiration_date:
s/expiration_date/expiration_dates/

To check that this change works as intended, here's a good request for options with an expiration date on 2019-02-15:
https://api.robinhood.com/options/instruments/?chain_id=1404730f-c77c-4fde-bf57-b8d5ea3bbe7c&expiration_dates=2019-02-15&state=active&tradability=tradable&type=put

In contrast, here's what is currently produced (no "s" on expiration_date):
https://api.robinhood.com/options/instruments/?chain_id=1404730f-c77c-4fde-bf57-b8d5ea3bbe7c&expiration_date=2019-02-15&state=active&tradability=tradable&type=put

This second one includes options that expire on 2019-03-15 and 2019-06-21.

How do I use this library / login?

After multiple attempts, I finally figured out that I somehow had the v1 installation instead of the v2 installation, and that the default v2 astuart.co/go-robinhood/v2 isn't up to date with the GitHub.

What is a context in Robinhood.dial?

 not enough arguments in call to robinhood.Dial
        have (*robinhood.OAuth)
        want (context.Context, oauth2.TokenSource)

An updated working example would be appreciated!

Multi-factor authentication

Does go-robinhood support MFA? When I sign in, I get a text message with a code to my phone but I can't find any functionality to send the code back.

Allow Option Legs

It looks like an option leg is hard-coded in the optionInput struct, which doesn't allow a user to add a leg to an order via OptionsOrderOpts. Would you accept a PR that addresses this?

Robinhood 2FA

Anyone have a solution for this? Robinhood now requires 2FA (two-factor authentication) and this API library returns an error.

Get "https://nummus.robinhood.com/accounts/": Two Factor Auth code required and not supplied

cc @andrewstuart @MitchK

access Token is blank

I want to get access token but it is blank
var loginCmd LoginCommand
context.BindJSON(&loginCmd)
cli, err := robinhood.Dial(&robinhood.OAuth{
Username: loginCmd.Username,
Password: loginCmd.Password,
})
fmt.Println("AccessToken", cli.Token) => return blank

Update README example for v2 API

The readme points to v2 docs, but the example is the v1 API.

I'd be happy to send a PR in to update the README if someone would help me understand how the new oauth login is supposed to work.

Thanks for putting this library together. After first trying this, I tried switching to a Python library, but fought python pip installs for 2 hours and gave up. I'd much rather use Go.

MarketData doesn't return all options

q := url.Values{"instruments": []string{strings.Join(is[i*num:end], ",")}}

It appears that MarketData doesn't return all options. I was originally trying to figure out why a specific option wasn't showing up when I used MarketData to query for all options contracts returned by a call to GetInstrument, but then I tried limiting the call to MarketData so that I only passed a single OptionInstrument -- calling with a single OptionInstrument doesn't return anything at all.

I made this tweak, and things seem to work now:

Line 241 old:
q := url.Values{"instruments": []string{strings.Join(is[i*num:end], ",")}}

Line 241 new:
q := url.Values{"instruments": []string{strings.Join(is[i*num:end+1], ",")}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.