GithubHelp home page GithubHelp logo

clintonbess / crypto-trader Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 5.22 MB

Stand alone client side automated trading for GDAX.

Home Page: https://aaronste.in

License: MIT License

JavaScript 85.70% HTML 0.33% CSS 13.97%

crypto-trader's Introduction

CircleCI

crypto-trader

Stand alone client side automated trading for GDAX

WIP @ aaronste.in

Getting Started

Chrome on OSX

Go to the profile page and upload browser data.

Other OS and Browser

Login to GDAX Open the browser console and navigate to the settings page

Find the GET request for /profiles

Copy the cb-session in the request headers

Go to the profile page on crypto-trader and paste in the cb-session to the session input and click save

Because this is app isn't backed by any server, before ending a session you can export your current config. Before starting a new session you can upload the config to start where you left off.

General features

  • Custom scripts
  • Order execution
  • Backtesting
  • Global live mode to prevent accidental trades
  • Script level live mode
  • Manual script execution
  • Automatic script execution when new data is added to the main chart
  • Subscribes to GDAX web socket feed for new data

Usage

Write scripts to trigger trades on GDAX

Click on the Product Data list item to see available data for the product

Reference the selected product on the chart with p

p.data[0].close

Use now when you want to reference the current data

p.data[now].close

Write conditions based on the data to execute all in / all out post-only limit orders with

if(p.rsi[now].value < 70){
  sell()
} else if(p.rsi[now].value > 30){
  buy()
}

Access order history for the current product with orders. Order history is recorded by strike price. If the order is a buy the price is negative. If the order is a sell the price is positive.

if(orders[0] > 0){
  log('First order you sold stuff')
} else if(orders[0] < 0){
  log('First order you bought stuff')
}

Use lastOrder to access the last order data

log(lastOrder)
//  {"id":"BTC-USD","time":"2016-12-08T20:02:28.53864Z","price":-2000}

Print to the log with log()

log('First RSI is ' + p.rsi[0].value)
// 12:21:00 am: First RSI is 0.70

Orders

Orders are made with the GTT flag set to min After one minute if the order has not been fully filled the triggering script will re-run. To take advantage of the retry logic it is best to write buy and sell conditions in a way that will be valid for a range in time, not a single instant.

Bad

if(p.rsi[now].value === 70){
  sell()
} else if(p.rsi[now].value === 30){
  buy()
}

Better

if(p.rsi[now].value < 70){
  sell()
} else if(p.rsi[now].value > 30){
  buy()
}

Testing your scripts

Write scripts using the now array index when accessing current data. Pass in custom id's to the buy() and sell() methods to label the plot lines.

if(rebound){
  buy('reboud')
} else if(kOverBuy){
  buy('kOverBuy')
}else if (lastKOverD){
  sell('lastKOverD')
} else if(!nowKOverD) {
  sell('!nowKOverD')
}

Red lines represent sells. Red dotted lines represent sells for a loss. Green lines represent buys.

Reserved viable names

product
profile
log
script
prods
prof
appendLog
now
buy
sell
lastOrder
orders
config

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.

crypto-trader's People

Contributors

aastein avatar

Watchers

James Cloos avatar Clinton Bess avatar

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.