BidFX package

The BidFX API provides a Session via which access is given to all of the API features. The Session represents a applications’s working session with the API for accessing either real-time pricing or the trading capabilities. Sessions open and maintain network connections to services running within the BidFX platform. They create threads to manage these connections asynchronously. These threads must be started explicitly after the Session has been configured.

Typical Usage

# Create the Session from the INI file at .bidfx/api/config.ini
session = Session.create_from_ini_file()

# Set the callback for receiving price update events
session.pricing.callbacks.price_event_fn = on_price_event

# Set the pricing threads
session.pricing.start()

# Subscribe to streaming FX prices for €1m EURUSD at spot from DBFX
subject = session.pricing.build.fx.stream.spot.liquidity_provider("DBFX")
    .currency_pair("EURUSD").currency("EUR").quantity(1000000).create_subject()
session.pricing.subscribe(subject)

Session

class bidfx.Session(config_parser)

A Session is the top-level API class which gives access to all of the features of the API. It represents a client’s working session with the API.

Parameters:config_parser (configparser.ConfigParser) – The API configuration settings.
static create_from_ini_file(config_file='~/.bidfx/api/config.ini')

Creates a new Session using configuration data parsed from an INI file. The default behaviour is to search for the file .bidfx/api/config.ini in the user’s home directory.

Parameters:config_file – is the name of the INI file.
Returns:the Session configured from the configuration file.
pricing

Gets the Pricing API session used for subscribing to realtime _prices.

Returns:A configured interface to the PricingAPI.
Return type:PricingAPI
static version() → str

Gets the API version number.

Return type:str

BidFXError

exception bidfx.BidFXError

Base class for all errors raised by the BidFX API. Extends Exception.

PricingError

exception bidfx.PricingError

Base class for all errors raised by the BidFX Pricing API. Extends BidFXError.

InvalidSubjectError

exception bidfx.InvalidSubjectError

Error indicating the a price Subject is invalid. Extends PricingError.