Skip to main content

This package is for using Flex Fills WebSocket communication with FlexFills trading services.

Project description

FlexfillsApi

The FlexfillsApi is a package for using Flex Fills WebSocket communication with FlexFills trading services.

Installation

Use the package manager pip to install FlexfillsApi.

pip install FlexfillsApi

Usage

import FlexfillsApi

# initialize FlexfillsApi, returns authenticated FlexfillsApi Object
flexfills_api = FlexfillsApi.initialize('username', 'password', is_test=True)

# get assets list
assets_list = flexfills_api.get_asset_list()

# get instruments list
assets_list = flexfills_api.get_instrument_list()

Available Functions

Functions Params Explaination
get_asset_list() Provides a list of supported assets and their trading specifications.
get_instrument_list() Provides a list of supported Instruments and their trading specifications.
subscribe_order_books(instruments, callback=None)

instruments: list of pair of currencies. All available pairs are:

BTC/PLN, DASH/PLN, EUR/GBP, LTC/GBP, LTC/USD, OMG/EUR, OMG/PLN, USDT/EUR, XRP/USD, ZEC/BTC, ZEC/PLN, ZRX/BTC, DOT/BTC, ZRX/USD, BSV/USDT, ADA/USDT, ZIL/USDT, ENJ/USD, XEM/USDT, BNB/USDT, BSV/EUR, BTC/EUR, DASH/EUR, LINK/USD, LTC/ETH, ZEC/USD, BAT/USDT, DOT/USDT, DOT/ETH, MATIC/USTD, AVAX/USDT, BAT/EUR, BAT/GBP, BCH/BTC, BTC/USDT, ETH/GBP, EUR/USD, LINK/BTC, LINK/ETH, LTC/EUR, LTC/USDT, USDT/GBP, XEM/USD, XLM/ETH, XRP/ETH, DASH/USDT, DASH/ETH, XTZ/USD, DAI/USD, ADA/USD, DOT/EUR, BAT/USD, BCH/USDC, BSV/USD, BTC/GBP, DASH/BTC, LTC/PLN, USDT/USD, XLM/BTC, XRP/PLN, ZRX/PLN, QTUM/USDT, ADA/USDC, USDT/USDC, QTUM/USD, MKR/USD, SOL/USD, ATOM/ETH, ATOM/USDT, QASH/USD, VRA/USD, BCH/ETH, BSV/PLN, BTC/USD, ETH/BTC, LTC/BTC, OMG/USD, USDC/EUR, USDC/USD, USDC/USDT, XEM/BTC, XLM/EUR, XLM/USD, XRP/EUR, BSV/ETH, XLM/USDT, ZEC/USDT, BAT/USDC, LINK/USDC, SOL/BTC, DOGE/USD, DOGE/BTC, BAT/BTC, BAT/PLN, BCH/GBP, BCH/PLN, BCH/USD, BTC/USDC, ETH/USDC, OMG/BTC, BTC-PERPETUAL, ETH-PERPETUAL, ZRX/EUR, ADA/BTC, QTUM/ETH, DOT/USD, SOL/ETH, ATOM/BTC, ETH/USDT, EUR/PLN, LINK/PLN, LINK/USDT, OMG/ETH, XRP/BTC, XRP/USDT, ZEC/EUR, ADA/EUR, ADA/PLN, DOT/PLN, OMG/USDT, EUR/USDT, DOGE/USDT, GALA/USDT, BAT/ETH, BCH/EUR, BCH/USDT, BSV/BTC, DASH/USD, ETH/EUR, ETH/PLN, ETH/USD, GBP/USD, USD/PLN, XLM/PLN, XRP/GBP, ZIL/USD, USDT/PLN, XRP/USDC, QTUM/BTC, ADA/ETH, ZIL/BTC, SOL/USDT, LUNA/USDT, ATOM/USD

callback: Callback function for getting streaming data.

Provides streaming services an order book for selected symbol, user needs to provide levels of order book to receive. MAX is 20. MIN is 1. Order books are sorted based on NBBO price: BIDs best (Max) first then descending, ASKs best (MIN) first then ascending. The whole Order books is updated every 20MS regardless of changes.
unsubscribe_order_books(instruments) instruments: list of pair of currencies.
trade_book_public(instruments, callback=None)

instruments: list of pair of currencies.

callback: Callback function for getting streaming data.

Provides streaming services a trading book (public trades) for selected symbol. Once subscribed updates will be pushed to user as they appear at FlexFills.
get_balance(currencies) currencies: list of selected currencies.
get_private_trades(instruments, callback=None)

instruments: list of pair of currencies.

callback: Callback function for getting streaming data.

Private trades subscription will provide a snapshot of currently open ACTIVE orders and then updates via WebSocket.
get_open_orders_list(instruments)

instruments: list of pair of currencies. optional

Get current list of open orders. One time request/response.
create_order(order_datas)

order_datas: The list of order data dict. The order data includes globalInstrumentCd, clientOrderId, orderType, timeInForce, price, amount, exchangeName, orderSubType, tradeSide

  • globalInstrumentCd - pair of currencies (BTC/USD, ...). string
  • clientOrderId: Id of the order. string
  • orderType: market - Market order, limit - Limit order. string
  • timeInForce: string, optional,
    • GTC - Good till cancelled (default, orders are in order book for 90 days)
    • GTD - Good till day, will terminate at end of day 4:59PM NY TIME
    • GTT - Good till time, alive until specific date (cannot exceed 90 days)
    • FOK - Fill or Kill, Fill full amount or nothing immediately
    • IOC - Immediate or Cancel, Fill any amount and cancel the rest immediately
  • price: optional, Price only required for limit orders
  • amount: Quantity of the order
  • exchange: Name of exchange to send order to, string, required
  • orderSubType: optional, string, POST_ONLY, only required if client wishes to submit a passive order which does not immediately fill the order, in case of immediate fill, order will be rejected
  • tradeSide: optional, string, Side of the order Enum buy or sell

Get current list of open orders. One time request/response.
cancel_order(order_datas)

order_datas: The list of order data dict. The order data includes globalInstrumentCd, clientOrderId, direction, orderType, timeInForce, price, amount, exchange

  • globalInstrumentCd - pair of currencies (BTC/USD, ...). string, required
  • clientOrderId: Id of the order. string, required
  • orderType: market - Market order, limit - Limit order. string, required
  • direction: Side of the order Enum "BUY", "SELL" and "POST_ONLY". string, required
  • timeInForce: string, required
  • price: Price only required for limit orders, string, required
  • amount: Quantity of the order, string, required
  • exchange: Name of exchange to send order to. string, required

User may cancel existing orders; client may cancel one order by either including orderId or exchangeOrderId if orderId is not known. Only one parameter is needed and will be accepted. If no orderId or transactionId are added in the message than, all orders for selected pair/s will be cancelled. Must be subscribed to valid pair in order to cancel order in proper pair!
modify_order(order_data)

order_data: The dict of order data, including globalInstrumentCd, clientOrderId or exchangeOrderId

  • globalInstrumentCd - pair of currencies (BTC/USD, ...). string
  • clientOrderId: Id of the account. string
  • exchangeOrderId: clientOrdId. string
  • price: If price is not passed in, then it’s not modified, string
  • amount: If price is not passed in, then it’s not modified, string

Clients may update existing orders. Amount or Price can be modified. Client must use clientOrderId or exchangeOrderId Only one parameter is needed and will be accepted
get_trade_history(date_from, date_to, instruments)

date_from: Start date of required time frame, string. example: "2022-12-01T00:00:00"

date_to: End date of required time frame, string. example: "2022-12-31T00:00:00"

instruments: list of pair of currencies.

Clients may request a list PARTIALLY_FILLED, FILLED trades for a required time frame. Channel arguments ‘date-from’, ‘date-to’ are optional. If ‘date-from’ is not provided, it will be defaulted to ‘now minus 24 hours’. If ‘date-to’ is not provided, it will be defaulted to ‘now’.
get_order_history(date_from, date_to, instruments, statues)

date_from: Start date of required time frame, string. example: "2022-12-01T00:00:00"

date_to: End date of required time frame, string. example: "2022-12-31T00:00:00"

instruments: list of pair of currencies.

statues: list of status.

Clients may request a list of COMLETED, REJECTED, PARTIALLY_FILLED, FILLED, EXPIRED order requests for a required time frame. Channel arguments ‘date-from’, ‘date-to’, ‘status’ are optional. If ‘date-from’ is not provided, it will be defaulted to ‘now minus 24 hours’. If ‘date-to’ is not provided, it will be defaulted to ‘now’. If ‘status‘ is not provided then trades with any status will be selected.
get_trade_positions()
trades_data_provider(exchange, instrument, period, timestamp, candle_count)

exchange: Name of exchange. string, required

instrument: pair of currencies (BTC/USD, ...). string, required

period: period can be ONE_MIN, FIVE_MIN, FIFTEEN_MIN, THIRTY_MIN, FORTY_FIVE_MIN, ONE_HOUR, TWO_HOUR, FOUR_HOURS, TWELVE_HOURS, ONE_DAY

timestamp: Timestamp. string, required

candle_count: The number of candles to get. integer, required

get_exchange_names()

exchange: Name of exchange. string, required

instrument: pair of currencies (BTC/USD, ...). string, required

period: period can be ONE_MIN, FIVE_MIN, FIFTEEN_MIN, THIRTY_MIN, FORTY_FIVE_MIN, ONE_HOUR, TWO_HOUR, FOUR_HOURS, TWELVE_HOURS, ONE_DAY

candle_count: The number of candles to get. integer, required

get_instruments_by_type(exchange, instrument_type)

exchange: Name of exchange. string, required

instrument_type: string, required

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

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

flexfillsapi-0.1.12.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

FlexfillsApi-0.1.12-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file flexfillsapi-0.1.12.tar.gz.

File metadata

  • Download URL: flexfillsapi-0.1.12.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for flexfillsapi-0.1.12.tar.gz
Algorithm Hash digest
SHA256 84040439bac8adce404e52b4fb3cd29cd523aab7e5edef0ac3db0958dfb2add6
MD5 a94410fa79b14d3b82bfd3e04dbbba4a
BLAKE2b-256 dd09d8c39450ba24f455294addbc32c86b76cb65ef5c0f316e7b1711de21c2b8

See more details on using hashes here.

File details

Details for the file FlexfillsApi-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for FlexfillsApi-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 1be1259da66c593f203aba8fe52901ab62b8a73c0a811de98d45f0f40d53679e
MD5 d73447c9098f58b633d7fedd475a7d19
BLAKE2b-256 fea1c94336c1894aa1a92bd8f7c5e76807f760b18bc78e3e84b67f64a9f2a16f

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