Skip to content

A program for creating simple orders & complex order arrays on cryptocurrency exchanges

License

Notifications You must be signed in to change notification settings

EvanGottschalk/OperateExchange

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

OperateExchange

A program for creating simple orders & complex order arrays on cryptocurrency exchanges
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

The purpose of OperateExchange is in its name - most actions a user would take on a cryptocurrency exchange, such as creating or cancelling orders, can be done using this program instead. The advantage of using OperateExchange is that users can create groups of dozens of orders, or cancel groups of orders. This allows for more efficient trading than using an exchange's normal interface, which usually only allows users to open or close one order per click.

Built With

  • Python 3.6

  • Pandas (optional; only necessary for charting)

  • Matplotlib (optional; only necessary for charting)

  • CCXT - The fantastic CCXT library is critical to ConnectToExchange. Huge thanks to @kroitor and the many other CCXT contributors that made this program possible.

  • ConnectToExchange - This is another program I wrote for creating the initial connection to a cryptocurrency exchange. You can read more about it here: github.com/EvanGottschalk/ConnectToExchange

  • GetCurrentTime - This program is imported to help collect time data in a legible fashion. It also allows for the translation of time stamps. You can read more about it here: github.com/EvanGottschalk/GetCurrentTime

  • AudioPlayer - This is a simple program for playing custom audio alerts. It can be used with ConnectToExchange to warn you if an error occurs. You can read more about it here: github.com/EvanGottschalk/AudioPlayer

  • QuadraticFormula - This is a simple program for calculating the solutions to a quadratic equation using the quadratic formula.

Getting Started

OperateExchange is easy to get up and running. Let me know if you have any trouble! I'm always trying to make installation as smooth as possible.

Prerequisites

Before using OperateExchange, you must first obtain an API key and secret from the cryptocurrency exchange of their choosing. You also need to install the CCXT library.

Installation

  1. Install CCXT, and optionally Pandas and Matplotlib if you want to see data visualizations. The easiest way to do this to download requirements.txt and use pip:

    pip install -r requirements.txt
    
  2. Download the .py files from this repository (OperateExchange.py, ConnectToExchange.py, GetCurrentTime.py, QuadraticFormula.py, and optionally AudioPlayer.py)

  3. In the same folder as ConnectToExchange.py, create a .txt file to store your API information. Its name should start with the exchange you are using, followed by an underscore, followed by the name of the account you're using, and ending with _API.txt.

For example, if you are using your Main account on Coinbase, you would name the .txt file Coinbase_Main_API.txt

If your API key is view-only, you can save your cryptocurrency exchange API key on the 1st line, and your API secret on the 2nd. However, if your API key has trade priveleges, you should save an encrypted version of both your key and secret on those lines instead.

To encrypt your API information, I recommend using CustomEncryptor.py, which can be downloaded here: github.com/EvanGottschalk/CustomEncryptor

  1. Run OperateExchange.py

  2. Congratulations! You can now use OperateExchange to create and cancel orders on your chosen cryptocurrency exchange!

Usage

Example 1 - Creating an Order

The following code will create a limit order for $100 worth of bitcoin priced at $30,000.

OE = OperateExchange()
OE.createOrder({'Exchange': 'Coinbase', \
                'Symbol': 'BTC/USD', \
                'Side': 'buy', \
                'Amount': '100', \
                'Order Type': 'Limit', \
                'Price': 30000})

Example 2 - Getting a dataframe and CSV of the open, high, low, close & volume values over the 1 minute timeframe

OE = OperateExchange()
OE.getOHLCVs('', 'BTC/USDT', '1m')

Example 3 - Cancel a group of orders to buy or sell bitcoin at prices between $32500 and $37500

OE = OperateExchange()
OE.CTE.connect('Coinbase')
OE.cancelOrderGroup({'Symbol': 'BTC/USD', \
                     'Lowest Cancel Price': 32500, \
                     'Highest Cancel Price': 37500})

Example 4 - Create an array of orders from $30,000 to $29,000 separated by $50 each on Coinbase totalling $100 in value. Since the style is 'Linear', the $100 of buying power will be distributed linearly from $30,000 to $29,000, with the largest order at $29,000 and the smallest at $30,000.

OE = OperateExchange()
OE.createArrayOrder({'Exchange': 'coinbase', \
                     'Symbol': 'BTC/USD', \
                     'Side': 'buy', \
                     'Amount': 100, \
                     'Order Type': 'limit', \
                     'Price': 30000}, \
                    {'Granularity': 50, \
                     'Spread': 1000, \
                     'Steepness': 0, \
                     'Minimum Order Size': 1, \
                     'Style': 'Linear'})

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU GPL-3 License. See LICENSE for more information.

Contact

Evan Gottschalk - @Fort1Evan - [email protected]

Project Link: https://github.com/EvanGottschalk/OperateExchange

Acknowledgements

Thinking about contributing to this project? Please do! Your Github username will then appear here.

About

A program for creating simple orders & complex order arrays on cryptocurrency exchanges

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages