Comments (3)
It feels like you still arent on the correct package version. In the patch I made, i changed the structure of the RH object which is why that code no longer works.
Snippet from api_login.R
# Storage for api data
RH <- c(
# APIs
api_request = list(
grant_type = "password",
client_id = "c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS",
device_token = uuid::UUIDgenerate(),
scope = "internal"
),
api_response = list(
access_token = "000",
refresh_token = "000",
expires_in = 0,
token_type = "000",
scope = "000",
mfa_code = "000",
backup_code = "000"
)
)
Snippet from api_orders
if (action == "order") {
url <- RobinHood::api_endpoints("orders")
token <- paste("Bearer", RH$api_response.access_token)
detail <- data.frame(account = RH$url.account_id,
instrument = instrument_id,
symbol = symbol,
type = type,
time_in_force = time_in_force,
trigger = trigger,
price = price,
stop_price = stop_price,
quantity = quantity,
side = side,
client_id = RH$api_request.client_id)
dta <- POST(url = url,
add_headers("Accept" = "application/json",
"Content-Type" = "application/json",
"Authorization" = token),
body = mod_json(detail, type = "toJSON"))
httr::stop_for_status(dta)
dta <- RobinHood::mod_json(dta, "fromJSON")
dta <- as.list(dta)
The new version should be trying to get your client id from your new RH object client_id = RH$api_request.client_id
so if you had to copy it from your old structure, i wonder if you are really on the latest version. If thats not the case I will trouble shoot further.
from robinhood.
Ah, I see the problem -- I saved the RH authentication object before you updated the package, then used the older object to place the order. My bad! The new version works great. Thanks!
from robinhood.
Thanks JestonBlu again for tackling the API issue so quickly. I have a related issue I thought I'd bring up here.
I'm running into an odd error with api_orders as well where I can seem to place a sell order, but get Bad Request (HTTP 400).
when trying to place a buy order. I've tested this a few times and it rejects only buy orders. This is on 1.6.8. Any ideas?
from robinhood.
Related Issues (20)
- fractional shares and "sell all" HOT 2
- get_positions_options: Column `updated_at` doesn't exist HOT 4
- get_positions_options: Column `state` doesn't exist HOT 1
- Buy in dollars rather than shares? HOT 2
- feature request: trailing stop for stocks
- HTTP 400 error for get_tcierks(RH, add_fundamentals = T)
- Getting Bad Request (HTTP 400) Error HOT 14
- argument "mfa_code" is missing, with no default HOT 3
- MFA Requirement HOT 30
- HTTP 400 Bad Request on api_login
- Error in get_historicals_options HOT 4
- 404 on vignette getting started HOT 1
- logout() function is returning Internal server error 500 HOT 2
- Placing an order in extended hours
- Current Bugs
- Retirement Accounts
- Have you considered using MFA HOT 1
- Can't place orders HOT 2
- Error when I run get_positions() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robinhood.