Code Monkey home page Code Monkey logo

algotrader's Issues

Missing Auth in the Instrument.getFundamentals

Looks like now to get the data from a stock you also need to be logged in. I was getting a 401 when trying to do it without any auth param.

Modified the static getByUrl to accept the user and added the header with the user.getAuthToken

On Auth: "This version of robinhood is no longer supported..."

Looks like Robinhood has changed their API, and I'm getting this issues:

"This version of Robinhood is no longer supported. Please update your app or use Robinhood for Web to log in to your account."

Looks like there's a fix in for it, any chance we can merge: Gillinghammer-patch-2 ?

Using in React

Hi, do you know if I should use the same installation steps for a React app? This has been my experience:

  1. Installed with 'yarn add algotrader'
  2. Added 'const algotrader = require('algotrader');'
  3. Compile fails.
    errors

I really like your work, thank you for making it available.

ERROR in ./node_modules/algotrader/objects/broker/robinhood/User.js
Module not found: Error: Can't resolve 'fs' in 'C:\AndroidAppDev\xcharts-react-webview\node_modules\algotrader\objects\broker\robinhood'
 @ ./node_modules/algotrader/objects/broker/robinhood/User.js 19:9-22

TypeError: Scheduler.onMarketOpen is not a function

Hi,
I am getting following error while using given example in the package. Please help how to fix it.

using node v12.13.0.

c:\test\node examples\highest-open-interest.js
C:\test\node_modules\algotrader2\examples\highest-open-interest.js:28
Scheduler.onMarketOpen(5 * 60000, open).catch(error => console.error(error)); // Run every day on market open
^

TypeError: Scheduler.onMarketOpen is not a function
at Object. (C:\test\node_modules\algotrader2\examples\highest-open-interest.js:28:11)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11

Support for indian brokers

Hey bro,

Can you help with one Indian broker (Angel Broking) and i can add more.

Or in near future if we want to implement the same.

Robinhood Auth Issues

I believe the Robin hood api has change and the User class with isAuthenticated method is not working any more. We are using it with GQL and getting Library Error:"this version of robinhood is no longer supported ...."

Any solution?

Robinhood responded with code 401: unauthorized. { "detail": "Incorrect authentication credentials." }

I'm trying to authenticate my Robinhood user programmatically, so I can issue trades programmatically, using the following recommended code:

const myUser = new User(credentials.username, credentials.password, options);

myUser.authenticate()
    .then(() => {
        // User was authenticated
        console.log("Algotrader User Authenticated...");
    })
    .catch(error => {
        console.log("Authentication Error: " + error);
    });

But I'm getting the following error printed to the console when I run the app.js file:

image

Can anyone shed some light on this issue please? Thanks in advance!

Robinhood 404

I'm getting an error after following the documentation. Either I missed something, or this is an unexpected error.

(node:186620) UnhandledPromiseRejectionWarning: Error: Robinhood responded with code 404: not found | Not Found

The requested URL /accounts/null/positions/ was not found on this server.

Here is my code:

myUser.getPortfolio()
.then(myPortfolio => {
let myTeslaShares = myPortfolio.getQuantity("TSLA");
let bestDayEver = myPortfolio.getPurchaseDate("SHLD");
let mySymbols = myPortfolio.getSymbols();
let myMoneyMakers = myPortfolio.getQuantityGreaterThan(50);
})
.catch(error => {
console.log("getPortfolio Failed!", error);
})

where myUser is an authenticated Robinhood.User

Trading RH options with stop loss

Thanks for digging out the API for RH options trading! I can place a limit order to buy options algorithmically. However I was hoping you could provide an example to add a stop loss to my options order. I think it can be enabled by adding to the legs option here:

https://github.com/Ladinn/algotrader/blob/a111eaafd8c85a51e952734429a41d5ba87dd7a6/objects/broker/robinhood/OptionOrder.js#L39

Here is an example of how I can buy qty contracts of instrument x under account a for ask price p:

{
"quantity":qty,
"direction":"debit",
"type":"limit",
"price": p,
"account":a,
"time_in_force":"gfd",
"trigger":"immediate",
"legs":
[
      {"side":"buy","option":instrument,"position_effect":"open","ratio_quantity":"1"}
],
"override_day_trade_checks":False,
"override_dtbp_checks":False, 
"ref_id":ref_id}

How would I amend to this JSON statement to add a stop loss at price q, where q < p?

Error: Robinhood responded with code 401

Running into an issue that happened recently, so I am wondering if something changed in the Robinhood API.

const instrument = await Instrument.getBySymbol(symbol);
// works fine & returns the instrument from Robinhood
// But now when I use that generated instrument to get the Quote I have a 401 response from Robinhood
const stockQuote = await instrument.getQuote();
// Error: Robinhood responded with code 401

Robinhood OptionOrder: Server Error 500

Robinhood is responding with status code 500 (server error) when submitting an option order.

@briansp2020:

Thanks for your help. I tried to place an option order but was not successful. I'm new to javascript so I'm sure I did something wrong. Could you take a look at the code below and let me know what I'm doing wrong?

myUser.authenticate()
.then(() => {
// User was authenticated

// First, we'll get the instrument and tradable expiration dates for SPY.
Instrument.getBySymbol("SPY").then(ins => {
    OptionInstrument.getExpirations(myUser, ins).then(option => {
        // Next, we'll fetch an option chain for the upcoming expiration date.
    	OptionInstrument.getChain(myUser, ins, option[0], "put").then(optionChain => {
                console.log(optionChain[4]);

    	    // An array of OptionInstruments will be returned. See the example below.
	    // You'll then want to find the specific OptionInstrument that you want to trade.
	    // In this example, we'll buy using the first element in the array.
	    let order = new OptionOrder(null, myUser, optionChain[4], "credit", "gtc", "buy", "market", 1);
	    order.submit().then(res => {
    	        // Order was submitted, the response will be parsed as a completed OptionOrder.
		console.log("Order submitted");
		console.log(res);
		});
	    })
	})
    });
})
.catch(error => {
	// Either the request failed, or Robinhood responded with an error.
    // (Ex: you don't have internet access or your user credentials were incorrect)
})

I get the following error message

OptionInstrument {
  url: 'https://api.robinhood.com',
  tradability: 'tradable',
  strikePrice: 260,
  state: 'active',
  type: 'put',
  symbol: 'SPY',
  minTicks: { cutoff_price: '0.00', below_tick: '0.01', above_tick: '0.01' },
  instrumentURL: 'https://api.robinhood.com/options/instruments/487f72f2-b797-4016-8ff7-8dd172029808/',
  ids: 
   { chain: 'c277b118-58d9-4060-8dc5-a3b5898955cb',
     option: '487f72f2-b797-4016-8ff7-8dd172029808' },
  dates: 
   { expiration: 2019-03-04T00:00:00.000Z,
     created: 2019-01-25T03:08:09.376Z,
     updated: 2019-01-25T03:08:09.376Z } }
(node:25477) UnhandledPromiseRejectionWarning: Error: Robinhood responded with code 500 | <h1>Server Error (500)</h1>

> Please report all unexpected errors on GitHub: https://git.io/vpYYL

    at Function.handleResponse (/home/briansp/node_modules/algotrader/objects/broker/robinhood/Robinhood.js:23:11)
    at Request.request.post [as _callback] (/home/briansp/node_modules/algotrader/objects/broker/robinhood/OptionOrder.js:98:22)
    at Request.self.callback (/home/briansp/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/home/briansp/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/home/briansp/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
(node:25477) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25477) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Server error 500 is the same error message I'm getting from the python api. If I change "gtc" to "GTC" as shown in the example in readme, I get 400 error along with the following error message.

(node:25697) UnhandledPromiseRejectionWarning: Error: Robinhood responded with code 400.

{
  "time_in_force": [
    "\"GTC\" is not a valid choice."
  ]
}

Any ideas? I'd like to get the option order placement working using this API before trying to get the python API working. Any help would be appreciated.

Thanks!

Originally posted by @briansp2020 in #12 (comment)

binance exchange support

wanna check if this library durable to retrieve binance buy and sell and apply with strategy?

auth

has auth broken? I haven't looked into it I was just made aware all my trades are failing.

this is the error message:

node:64416) UnhandledPromiseRejectionWarning: Error:

Not Found

The requested URL /api-token-auth/ was not found on this server.

thanks

Getting option chain quotes/info using OptionInstrument.getBySymbol()

I realize your Options support is in progress. In your documentation for OptionInstrument's method getBySymbol() you acknowledge that

"As there is no apparent way to query Robinhood options by symbol, all instruments will be downloaded and filtered. This will take a while on first run. After, set 'cache' to true."

"Take a while on first run" was quite the understatement in my case! I let it run for about 16 hours, downloading data from Robinhood, and then it crashed because it ran out of memory on the heap.

There's a ton of data. I hacked the code to stringify the data and write to a file stream (to fix the memory issue) ... but the resultant file has so much text that my computer hangs just trying to open it.

Maybe I need to set some parameters to the /options/instruments/ endpoint, or a different endpoint completely that would allow a more targetted request by symbol. I'll keep investigating. Any thoughts you have on this would be appreciated. =)

How are you connecting to rh?

I see a device token needs to be passed in. Can you put me in the right direction as to how I'm supposed to generate one?

Issue with getHistoricals

When trying to get the user historicals, the getHistoricals method is missing the account number in the qs object

qs: { account_number: _this.account, ......

TD/paper trading

hello! Do you have a timeline for TDameritrade support with backtesting and papertrading support? Is this being developed for commercial use or contributors?

Maybe add period paramter for IEX financials

Hi Team,

i would suggest to add a parameter period for the function getFinancials(symbol) to be able to retrieve the annual data as well or to add a new function for it?

regards

Jan

3.0 release milestone

Finally getting back around to this repo and I really want to give some love back. I think this is the best on the market right now. Ideally, Robinhood will support this venture!

Quality of life:

  • typescript refactor
  • backwards compatible

New features:

  • market watch screener
  • one-time passcode puppeteer support

Robinhood

  • fractional shares
  • fix all broken v2

API integrations:

IEX token

Hi,

Currently, trying to use the IEX.getLogo() method, but I'm getting a forbidden issue due to no token given to the API.

Is there a way where I can pass in the token as a property within IEX?

Thanks

Open to a TypeScript conversion?

Would you be open to using TypeScript for this project? I'd love to wrap this package and start adding types for intellisense and typeahead for objects.

Would you be open to TypeScript if I configured a build system for it?

Support for fractional shares

Robinhood now supports orders for fractional shares for most equities. Is this possible in algotrader or will it be possible in the future?

Can't seem to sign in properly.

I'm attempting to sign into Robinhood using algotracker's methods. I.E. I'm doing this:

const User = robinhood.User;

const myUser = new User("username", "password", "token");

myUser.authenticate()
.then(() => {
// User was authenticated
console.log("User authenticated...")
})
.catch(error => {
// Either the request failed, or Robinhood responded with an error.
// (Ex: you don't have internet access or your user credentials were incorrect)
});

However, I'm getting the following error:

Robinhood responded with code 401: unauthorized.

This at one point did download a number of objects from Robinhood when placing a call to:
const option = await Instrument.getBySymbol(optionSignal.Ticker);

Your guess is as good as mine - better if you get it right.

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.