Giter Site home page Giter Site logo

terrorizer1980 / coinbase_trader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kevin-roberts/coinbase_trader

0.0 0.0 0.0 239 KB

A python application to set complex Coinbase trading orders. Limits, stop losses, trailing stop losses, ect.

License: MIT License

Python 100.00%

coinbase_trader's Introduction

coinbase_trader

A python application to set complex Coinbase trading orders. Market orders, Limits, stop losses, trailing stop losses by percent or value, and one starts another orders. Uses Coinbase API and your api_key or oauth2 credentials (https://coinbase.com/docs/api/authentication) to execute real trades through Coinbase. Nearly every Coinbase API function has been implemented so you can also send, receive, and request bitcoins or check your account information, transaction history, ect.

Requirements

Example

from trader import Trader, CoinOrder
# oauth2 example setup can be seen in example.py of coinbase_python library
myTrader = Trader(api_key = 'my API key', logname = "mylog.txt")
# Setup order to Sell 0.5 bitcoin 10% lower than highest price seen by Trader.trade() 
# Use the optional price attribute to specify the max seen price so far, default is 0.
myTrader.setTrailingStopLossPercent(qty = 0.5, changeval = 10) 
# Setup order to Buy 0.5 bitcoin at 800 dollars per coin
myTrader.setLimitBuy(qty = 0.5, price = 800)
# Attempt to execute all trades once per sleep time until all trades have been executed
myTrader.trade(sleeptime = 60)

Notes

  • Trader.trade() function can run for a specified length of time.
  • Support has been added to easily run Trader.trade() in a seperate thread safely. Allowing you to add or remove orders from the orderbook easily (see testTrader.py for examples).
  • Can call functions from coinbase_python api via Trader.account object (could be dangerous in multithreaded mode without Trader._executeLock mutex)
  • TODO: preserve orderbook in a file and optionally reload the orderbook via an input to the python call this would be more useful once the threading feature above were added to save the user input and the other reason for this is to save the max seen value for trailing stop loss orders. The only time that max value is lost when the CoinOrder object is destroyed for any reason.
  • TODO: Setup as module with setup.py vs just importing
  • TODO: I am contemplating adding btc-e support (through a module already created for btc-e or with the requests library used by coinbase_python) and an algorithm that will trade on its own accord. For example, the program could pull in historical data and run a predictive learning classifier model to either buy or sell your coins based on historical data (possibly an SVM classifier), this would be a more significant update.

Contributing / Credits

So far just me Kevin-Roberts but contributions are greatly appreciated.

Disclaimer

This program executes REAL bitcoin trades with money from your coinbase account using the Coinbase API. Use and trade with this program at your own risk as I am not liable for any losses incurred using this software.

License

(The MIT License)

Copyright (c) 2014 Kevin Roberts [email protected]

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.

coinbase_trader's People

Contributors

kevin-roberts 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.