Giter VIP home page Giter VIP logo

robinbot's Introduction

robinbot

NO LONGER MAINTAINED

Description

Robinbot is a command-line swing trading bot using Node.js and unofficial Robinhood API. It features:

  • Fully-automated technical-analysis-based trading approach
  • "Paper" trading mode, just suggesting what's to buy, sell, hold and which stops should be
  • Risk management based portfolio allication
  • Configurable (trailing) profit stops automatic allocation
  • Earnings announcements impacts
  • Market breadth analysis
  • User defined strategies
  • Fundamental analysis
  • Last year backtest

The bot performs technical analysis and places orders, for best results it should be run once a day at the end of market day, ex. 15 minutes before close.

Quick-start

Step 1) Requirements

  • Linux / MacOS
  • Node.js (version 8.9 or higher)

Step 2) Install Robinbot

Run in your console,

git clone https://github.com/yura505/robinbot.git

Create your configuration file by copying conf-sample.js to conf.js:

cp conf-sample.js conf.js
  • View and edit conf.js.
  • You must add your Robinhood login/password and Quandl API key to configuration file for paper and live trading.
  • For backtesting you have to provide only your Quandl API key to conf.js, no Robinhood credentials needed.
  • Quandl API key can be free obtained from quandl.com

Install dependencies:

npm install

Run a previous year backtest of default strategy

./backtest.js

Run a default strategy in paper mode

./robinbot.js

After you've simulated, you can place real orders:

./robinbot.js --trade

For a list of options use:

./robinbot.js -h

Implement custom strategy

Feel free to implement custom strategy in strategy.js file and use it on you own risk. Default strategies there just for information and they should not be used as is for live trading.

Changelog

  • v0.0.1
    • Initial version

TODO

  • Use neural networks, genetic algorithms, machine learning
  • Add more strategies, include adaptive
  • Add stock screener to find securities to trade
  • More accurate backtest with slippages and liqudity
  • Adopt it for different brokers
  • Improve usability and documentation

Thanks!


License: MIT

  • Copyright (C) 2018 Yury Kotlyarov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

robinbot's People

Contributors

ags- avatar beefy avatar justanotherkevin avatar yura505 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robinbot's Issues

Artificial Neural Networks (ANNs) and Genetic Algorithms

In modern trading systems using of Artificial Neural Networks (ANNs) and Genetic Algorithms are very popular. NodeJS has some of modules to solve ANN's, ex. ConvNetJS, but how to use them? Need to model correct network structure and pass correct parameters to forecast price direction.

TypeError: body.results is not iterable

If you incorrectly enter your Robinhood account details, it still attempts to run the bot throwing TypeError: body.results is not iterable on line 16 of instruments.js

A simple catch will fix this easily but wanted to point it out.

Authentication error

I am getting an authentication error check conf.js I have already double checked and it was working before today. Please advise

TypeError: Cannot read property 'unallocated_margin_cash' of null

./robinbot.js
*** ROBINBOT (paper mode) today: 2018-09-08 11:44:11
Downloading instruments: [ AMD HP KR STI VGT PLNT FFTY UGA XLF IBB ]
Downloading nonzero positions...
Downloading account information...
/home/zero/stock-software/robinbot/account.js:11
_cash = n(body.results[0].margin_balances.unallocated_margin_cash).value()
^

TypeError: Cannot read property 'unallocated_margin_cash' of null
at Request._callback (/home/zero/stock-software/robinbot/account.js:11:59)
at Request.self.callback (/home/zero/stock-software/robinbot/node_modules/request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/home/zero/stock-software/robinbot/node_modules/request/request.js:1163:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (/home/zero/stock-software/robinbot/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)

Receive this error when running robinbot on fresh install of Debian stretch

fast premature exit

Hello, great work!

However, after I configured my own credentials and list of stocks in conf.js, it exits in about 2 seconds. No errors printed.

How do I troubleshoot?

I've dropped in "console.log('here!');" lines to infer it gets as far as ticker_instrument[ticker] = t.url; in instruments.js only once, but am really out of my league with nodejs.


./robinbot.js -s macd
*** ROBINBOT (paper mode) today: 2018-09-14 22:46:16
Downloading instruments: URA   

 node -v
v9.5.0

 lsb_release -a; uname -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:        16.04
Codename:       xenial
Linux strategio 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it!
npm WARN [email protected] No repository field.

audited 490 packages in 4.545s
found 19 vulnerabilities (3 low, 11 moderate, 4 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.1.0 → 6.4.1       │
   │   Changelog: https://github.com/npm/npm/releases/tag/v6.4.1   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯


 npm update
npm WARN [email protected] No repository field.

+ [email protected]
updated 1 package and audited 490 packages in 12.938s
found 19 vulnerabilities (3 low, 11 moderate, 4 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

npm audit

^ TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined

I ran ./robinbot.js and got this error . I dont have that error few days ago .

Downloading instruments: [ AMZN /home/nton232/projects/crypto2/robinbot/instruments.js:16
for (let t of body.results) {
^

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
at Request._callback (/home/nton232/projects/crypto2/robinbot/instruments.js:16:37)
at Request.self.callback (/home/nton232/projects/crypto2/robinbot/node_modules/request/request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (/home/nton232/projects/crypto2/robinbot/node_modules/request/request.js:1157:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (/home/nton232/projects/crypto2/robinbot/node_modules/request/request.js:1079:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)

why does readme say osx/linux only?

works fine for me on windows. In my last 7 years I've only rarely found node apps that are not cross-platform, and when they don't work, it's usually just bad node-gyp config.

All improvements are welcome!

This project is looking for new ideas, new pull requests, any improvements. Everything for make it better. Robinbot wants to be more flexible and configurable, go beyond the limited functionality.
Also nobody knows how it works on Windows platform. Let's create free trading bot together.

Error running backtest.js "F in JSON at position 0"

$ node backtest.js

*** BACKTEST today: 2020-08-25 8:15:50 PM
Downloading historical quotes...
SyntaxError: Unexpected token F in JSON at position 0
at JSON.parse ()
at parse_historical (robinbot/quotes.js:93:27)
at Request._callback (robinbot/quotes.js:46:9)
at Request.self.callback (robinbot/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request. (robinbot/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage. (robinbot/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
Downloading historical quotes...

I have tried npm update & install & audit fix

$ nodejs -v
v12.18.3

$ npm --version
6.14.6

Operating System: Ubuntu 16.04.7 LTS

Any ideas what might be causing this? Tried on fresh install of ubuntu & Ubuntu shell on windows 10. Have added api to conf.js
c.quandl_token = "zE4ymuR1APIsYxZXs";

only thing I changed in the conf.js after rename.

login broken now

It was working last week, but today I get:

Error: token not found {"detail":"This version of Robinhood is no longer supported. Please update your app or use Robinhood for Web to log in to your account." ....

Technical indicators usability

Current using of technical indicators (technical.js) not very easy for creating new strategies, because many of parameters are hardcoded inside of indicators, and visual representation of indicators are statically hardcoded in strategy.js. On each strategy loop, user see table like below.
But better if this table allocate indicators dynamically based of using them in particular strategy. For example if user trades MACD strategy, he is not insteresting in Slow Stochastic indicators and back.
So,
if MACD strategy there should be CLOSE, ADX, MACD0, MACD, OBV/MA
If Slow Stochastic 14,3 - CLOSE SS.K SS.D OBV/MA
If Buy And Hold - CLOSE SMA50 SMA100 SMA200
etc.

SYMBOL  RANK   CLOSE  SMA50  SMA200  SS.K  ADX  MACD0   MACD     SAR      ATR   OBV/MA  RSI    EARNINGS   RESULT
------ ------ ------- ------ ------ ------ --- ------- ------ --------- ------- ------ ----- ------------ ------
SPY      1.00  274.71  272.5  255.1   72.0  35    0.00   0.34  258.72^     4.43  1.025 54.00              
QQQ      1.00  168.17  162.2  149.5   86.1  28    0.25   0.48  155.12^     3.14  1.009 60.00              
DIA      1.00  252.91  252.2  229.7   66.1  34   -0.25   0.09  239.04^     4.46  1.016 52.00              

Backtest.js "ReferenceError: list is not defined"

Hey!
This looks very promising!
Thank you so much for all your work, I'm very excited to start trying this out!
I am however running into a issue running the backtest.js:

*** BACKTEST today: 2018-07-07 6:11:32 PM
Downloading historical quotes...
Downloading delayed today quotes...
Downloading NASDAQ Composite index...
Downloading recent earnings...
/Users/mac/robinbot/earnings.js:77
                list.forEach(function(earning) {
                ^

ReferenceError: list is not defined
    at Request._callback (/Users/mac/robinbot/earnings.js:77:17)
    at Request.self.callback (/Users/mac/robinbot/node_modules/request/request.js:186:22)
    at Request.emit (events.js:180:13)
    at Request.<anonymous> (/Users/mac/robinbot/node_modules/request/request.js:1163:10)
    at Request.emit (events.js:180:13)
    at IncomingMessage.<anonymous> (/Users/mac/robinbot/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:272:13)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1106:12)
    at process._tickCallback (internal/process/next_tick.js:178:19)

Any chance you can help me figure out how to fix this issue?
Thanks!

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.