GithubHelp home page GithubHelp logo

metabot-tech / artis Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 79 KB

Trading bot for crypto currencies

License: MIT License

Python 99.14% Mako 0.58% Shell 0.06% Dockerfile 0.21%
cryptocurrencies trading-bot python

artis's Introduction

Artis

Simple trading bot for cryptocurrencies.

We decided to open-source the bot since we are no longer using it. The main strategy used is arbitrage. The supported markets are Liqui and Binance. We always traded between ETH and another coin. Mainly TRX and ADX.

Some of the code is legacy from other strategies or attempts. Start from strategies/balance if you want to analyse the code. I started a refactor in one of the branches, but I have not finished it. The main algorithm is pretty much all unit tested.

We also wanted to add automatic balancing between networks, but never got to it. There is still some code for that all around.

Setup

It is meant to run in docker. The docker-compose.yml file will spawn the service and the database. It will record all the transactions made by the bot and the balance of each coin in each market.

You will need to add a settings.yaml file with the following information:

DYNACONF:
    MARKETS: ['LIQUI', 'BINANCE']
    SLACK:
        TOKEN: '<YOUR TOKEN HERE>'
        CHANNEL: '#trading_bot' # Change this for the channel you want
    LIQUI:
        TIMEOUT: 30000
        SERVICE_FEE_HIGH: 0.0025 # Sometimes markets have a different fee when you place an order vs fulfill one
        SERVICE_FEE_LOW: 0.0010
        COINS: ['ADX', 'TRX'] # Supported coins
        API_KEY: <API KEY HERE>
        API_SECRET: <API SECRET HERE>
    BINANCE:
        TIMEOUT: 10000
        SERVICE_FEE_HIGH: 0.0010
        SERVICE_FEE_LOW: 0.0010
        COINS: ['ADX', 'TRX']
        API_KEY: <API KEY HERE>
        API_SECRET: <API SECRET HERE>
    DATABASE_URL: postgresql://{}:{}@localhost/{}
    COIN: "TRX" # Selected coin
    PRECISION: 0 # How many digits to use after the dot
    AMOUNT_TO_TRADE: 0.1 # Trade volume in ETH to trade each time
    MINIMUM_AMOUNT_TO_TRADE: 0.015 # Minimum volume in ETH for a trade to occur
    PROFIT_FACTOR: 1.0135 # Minimum difference (in %) in prices for a trade to occur
    PROFIT_REDUCTION: 0.005 # Reduction of profit if we missed the trade
    SERVICE_NUMBER: 1
    SLEEP_TIME: 0.05 # Sleep between iterations (avoid too many API requests)

artis's People

Contributors

sytten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

artis's Issues

Fees are not incorporated correctly

Since the fees on the two markets are not the same, this creates a problem because we are not reducing the amounts by the same proportion. That is why we never have the same growth rate on the ETH and the shitcoin.
While this is not dramatic because the percentages are small, this is a problem on the long term.

Add condition for sell cancellation

Before cancelling, we should check that the remaining part of the sell is more than the minimum you can sell on the market (normally 0.01 ETH).

try bid on bid order

when the bot are in no profit zone
the bot put a 0,1eth in amount of TRX( exemple 100 trx) on bid order book on exchange A and a 0,1eth (minus)- profit factor like 0.09865 eth for the same amount of TRX (100 trx) in another exchange B.

result of 1.36% of profit in eth or 0.00136 eth of profit.

Rework the selling price

Currently we use the 99.6% of the last price, but it could be lower if the profit was more than 1.35%.
We should use the exposure in the calculation of the new price.

Add retry when trading

Sometimes we fail to sell for no good reason except that the market bugged. We should always retry before failing.

Automatically switch accounts of liqui

Currently we are limited by the liqui limit, if we use the two accounts we will be able to double our profit.
Roadmap:

  • Before switching, resolve the ONGOING transactions
  • Add logic to support multiple keys
  • Add logic to support change of account (maybe a switch in the database)

Accumulate miss buy partially filled

Somethings a missed buy is partially filled, but not big enough to trade on the other market.
We should accumulate those small amounts and try to sell then later. Or at least keep track of them.

Avoid double spend of double buy

When a sell or buy failed because of timeout or other error, sometimes the order is still performed. We need to find a way to avoid this.
Suggestions:

  • Try to match volume and rate to one of our recent order
  • Check the difference in balance (can be tricky if pending orders are closed at the same time)

Accumulate miss buy

We should accumulate the amounts and average price to balance it out when possible.

Amounts are not revised when reselling

When we have a sell miss, we have to revise the amount we sell because we lower the sell price by 0.5%. If we sell on liqui, the exposure is 0.675% (for profit 1.35%). After deducing the fees 0.25% and the reduction 0.5%, we are in the negative...
We thus have to sell more to rebalance the 0.5% on the total exposure.

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.