All Projects â†’ pirate â†’ Crypto Trader

pirate / Crypto Trader

Licence: mit
💰 Cryptocurrency trading bot library with a simple example strategy (trading via Gemini).

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Crypto Trader

Ccxt.net
CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
Stars: ✭ 89 (-83.94%)
Mutual labels:  bot, bitcoin, trading, strategy
Ccxt
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
Stars: ✭ 22,501 (+3961.55%)
Mutual labels:  bot, bitcoin, trading, strategy
Cryptofeed
Cryptocurrency Exchange Websocket Data Feed Handler
Stars: ✭ 643 (+16.06%)
Mutual labels:  bitcoin, coinbase, gemini, trading
Go Coinbasepro
Go (golang) Client for the Coinbase Pro API https://docs.pro.coinbase.com
Stars: ✭ 277 (-50%)
Mutual labels:  bitcoin, coinbase, trading
Thetagang
ThetaGang is an IBKR bot for collecting money
Stars: ✭ 1,231 (+122.2%)
Mutual labels:  bot, strategy, money
Cryptotrader
A cryptocurrency trader for all famous exchanges
Stars: ✭ 228 (-58.84%)
Mutual labels:  bitcoin, trading, strategy
Krypto Trading Bot
Self-hosted crypto trading bot (automated high frequency market making) written in C++
Stars: ✭ 2,589 (+367.33%)
Mutual labels:  bitcoin, coinbase, trading
Cryptotrader
This is an experimental trading bot framework written in PHP. It may contain bugs and should not be trusted with much money
Stars: ✭ 108 (-80.51%)
Mutual labels:  bot, bitcoin, trading
Cointrol
āļŋ Bitcoin trading bot with a real-time dashboard for Bitstamp.
Stars: ✭ 1,351 (+143.86%)
Mutual labels:  bot, bitcoin, trading
Crypto Rl
Deep Reinforcement Learning toolkit: record and replay cryptocurrency limit order book data & train a DDQN agent
Stars: ✭ 328 (-40.79%)
Mutual labels:  bitcoin, coinbase, trading
Tradingview Webhook Bot
⚙ïļ Send TradingView alerts to Telegram, Discord, Slack, Twitter and/or Email.
Stars: ✭ 135 (-75.63%)
Mutual labels:  bot, bitcoin, trading
Crypto Trading Bot
Cryptocurrency trading bot in javascript for Bitfinex, Bitmex, Binance, FTX, Bybit ... (public edition)
Stars: ✭ 1,089 (+96.57%)
Mutual labels:  bot, coinbase, trading
Jesse
An advanced crypto trading bot written in Python
Stars: ✭ 1,038 (+87.36%)
Mutual labels:  bot, bitcoin, trading
Phptrader
A simple php powered Bitcoin and Ethereum trading bot
Stars: ✭ 131 (-76.35%)
Mutual labels:  bot, bitcoin, coinbase
Algo Coin
Python library for algorithmic trading cryptocurrencies across multiple exchanges
Stars: ✭ 365 (-34.12%)
Mutual labels:  bitcoin, coinbase, gemini
Kupi Terminal
Ccxt based, open source, customized, extendable trading platform that supports 130+ crypto exchanges.
Stars: ✭ 104 (-81.23%)
Mutual labels:  bot, bitcoin, trading
Ccxt Rest
Open Source Unified REST API of 100+ Crypto Exchange Sites (18k+ docker pulls) - https://ccxt-rest.io/
Stars: ✭ 210 (-62.09%)
Mutual labels:  bot, bitcoin, trading
Stocklook
crypto currency library for trading & market making bots, account management, and data analysis
Stars: ✭ 119 (-78.52%)
Mutual labels:  bitcoin, coinbase, trading
Tradzqai
Trading environnement for RL agents, backtesting and training.
Stars: ✭ 150 (-72.92%)
Mutual labels:  bitcoin, algorithm, trading
Cassandre Trading Bot
Cassandre makes it easy to create your Java crypto trading bot. Our Spring boot starter takes care of exchange connections, accounts, orders, trades, and positions.
Stars: ✭ 120 (-78.34%)
Mutual labels:  bot, coinbase, trading

Crypto Trading Bot Framework using the Gemini Exchange

💰 Python bindings for trading Bitcoin, Ethereum, & USD on the Gemini.com Exchange API.


ARCHIVED: Use https://github.com/ccxt/ccxt

Quickstart

  1. Download & install
git clone https://github.com/pirate/cryto-trader.git
cd crypto-trader
pip3 install -r requirements.txt
  1. Open https://exchange.gemini.com/settings/api and get an API key & secret
cp secrets_default.py secrets.py
nano secrets.py  # add key & secret here
  1. Start hacking!
import gemini_api as api
from symbols import Order, ETH, USD

current_price = USD(api.ticker('ethusd')['last'])
if current_price > USD(950.00):
    buy_order = Order(api.new_order('buy', 'ethusd', ETH(0.001), current_price))

    for event in order_events(buy_order.id):
        print(event)
  1. (Optional) run the example bot
nano settings.py                   # Confirm your bot parameters
python3 ./example.py ethusd        # Run the example theshold bot

Configuration

  • API Key Secrets: secrets.py
  • Bot Settings: settings.py

API Documentation

import gemini_api as api
from symbols import Order, USD, BTC, ETH

Data Types

Currencies:

  • symbols.USD: US Dollar USD(1.25)
  • symbols.BTC: Bitcoin BTC(0.000001)
  • symbols.ETH: Ethereum ETH(0.0001)

All currency symbols are based on the base type symbols.Currency.

Order: All API functions that deal with order data like new_order or order_status return a raw json dict from Gemini with the schema below. It can be converted to a type-checked python object by using Order(order_json).

order_json = {
    "order_id": "44375901",
    "id": "44375901",
    "symbol": "btcusd",
    "exchange": "gemini",
    "avg_execution_price": "400.00",
    "side": "buy",
    "type": "exchange limit",
    "timestamp": "1494870642",
    "timestampms": 1494870642156,
    "is_live": False,
    "is_cancelled": False,
    "is_hidden": False,
    "was_forced": False,
    "executed_amount": "3",
    "remaining_amount": "0",
    "options": [],
    "price": "400.00",
    "original_amount": "3",
}
buy_order = Order(order_json)
order_id = buy_order.id       # values can be accessed as properties

REST API Functions

The Gemini REST API functions documentation can be found here:
https://docs.gemini.com/rest-api/#requests

api.ticker(symbol: str) -> dict:
Get the ticker price info for a given symbol, e.g.:

ticker_info = api.ticker('ethusd')
# {'bid': '914.00', 'ask': '914.44', 'volume': {'ETH': '94530.56656129', 'USD': '83955829.9730076926', 'timestamp': 1515014100000}, 'last': '915.39'}
last_price = USD(ticker_info['last'])

api.new_order(side: str, symbol: str, amt: Currency, price: Currency) -> dict:
Submit a new order to Gemini, e.g:

buy_order = Order(api.new_order('buy', 'ethusd', ETH(0.01), USD(965)))
sell_order = Order(api.new_order('sell', 'ethusd', ETH(0.01), USD(965)))

api.order_status(order_id: str) -> dict:
Get the updated order info json from Gemini for a given order_id, e.g.:

buy_order = Order(api.order_status('44375901'))
print(buy_order.filled_amt)

WebSocket API Functions

The Gemini WebSocket API functions documentation can be found here:
https://docs.gemini.com/websocket-api/#websocket-request

api.order_events(order_id: str) -> Generator[dict]:
Get a live-updating stream of order events via WebSocket e.g.:

for event in api.order_events('44375901'):
    print(event)

Example Bot

example.py is a simple example bot that randomly creates some initial buys, then sells the moment it makes a certain threshold percentage of profit.

It might profit if the market is trending upwards, but generally this strategy doesn't work if you want to make any real money. This code serves as a boilerplate example upon which to build other, more advanced bots.

This type of tight, risk-averse bot will only make small profits because it never waits for big upward trends to max out, it sells as soon as it goes in the green. The days where it starts in the red and stays there also end up sucking much of the profit away.

Roadmap

  • Write a meta-trader that spawns multiple traders with tweaked parameters to see which ones make the most money
  • Add GDAX/Coinbase Exchange API bindings
  • Add Bitfinex Exchange API bindings

Developer Info

This library is built on Python 3.6 and uses MyPy for type checking.

Check MyPy types:

env MYPYPATH=./stubs mypy example.py

Disclaimer

I'm not responsible for any money you lose from this code. The code is MIT Licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].