Skip to main content

cli tool for write your own trade algorithms

Project description

Algomax-CLI

A command line tools for working with EMAX API.

install the package with bellow command:

-> pip install algomax

use bellow command for working with the package:

-> algomax algorithm.py config.json -p params.json -m schedule.json

Example

Here is a simple example of using algomax

algorithm.py

import os
import sys
import json
import math
from order import Order
import utils


def run_algorithm():
    config = utils.get_settings()
    trader_order = Order(config['broker_url'])

    params = utils.get_params()

    # algorithm
    data = fibonacci_algorithm(params['data'])

    # trade
    trader_order.create(data)


def isPerfectSquare(number: int): 
    squrare_number = int(math.sqrt(number)) 
    return squrare_number * squrare_number == number 


def isFibonacci(number): 
    return isPerfectSquare(5 * number * number + 4) or isPerfectSquare(5 * number * number - 4) 


def fibonacci_algorithm(data: dict):
    qunatity = data['quantity']
    if isFibonacci(qunatity):
        qunatity += 3
    else:
        qunatity -= 3

    data['quantity'] = qunatity
    return data

if __name__ == '__main__':

    run_algorithm()

config.json

{
    "broker_url": "http://your-broker.server",
    "access_token": "YoUr-ToKeN",
    "account_id": "your-account-id"
}

params.json (your algorithm data)

{
    "data": {
        "agent_id": "2",
        "side_id": "1",
        "instrument_id": "instrument-id",
        "price": 1234.0,
        "quantity": 1934,
        "validity_type_id": "1",
        "validity_date": ""
    }
}

mode.json (scheduling)

{
    "mode": "interval",
    "schedule": {
        "start_date": "2019-09-22",
        "end_date": "2019-10-23",
        "minutes_interval": 1,
        "start_time": "8:30",
        "end_time": "13:00"
    }
}

Caution: utils.py, order.py -> use algomax-engine package, but it's not ready yet ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algomax-0.3.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

algomax-0.3.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file algomax-0.3.1.tar.gz.

File metadata

  • Download URL: algomax-0.3.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for algomax-0.3.1.tar.gz
Algorithm Hash digest
SHA256 efa553be44fc2f626fa90791b32a1f2f2cae0b3ec57c577dc2874d92bee4a45b
MD5 c1e069c4d3862174f054591a5d9e4559
BLAKE2b-256 0db1679036afb5ef9d802660d4c7b3751609b720f027be6f79e074eaed6c4ba4

See more details on using hashes here.

File details

Details for the file algomax-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: algomax-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for algomax-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b46c527e7a45990ea41f2c02a56503a76cd2d2420a885a7a42537c098cf4bfd4
MD5 08e1753f1578dce787287dd0519cab8a
BLAKE2b-256 5918d43121378a87cea931ab4033a187c9690adb956a5586755314930c528014

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page