haasomeapi.apis.MarketDataApi module

Functions

class haasomeapi.apis.MarketDataApi.MarketDataApi(connectionstring: str, privatekey: str)

Bases: haasomeapi.apis.ApiBase.ApiBase

The Market Data API Class. Gives access to the market data endpoints

Parameters:
  • connectionstring – str: Connection String Formatted Ex. http://127.0.0.1:9000
  • privatekey – str: Private Key Set In The Haas Settings
get_all_price_markets()

Returns all markets

Returns:HaasomeClientResponse
Returns:In .result List[Market] of markets
get_all_price_sources()

Returns all avalible price sources

Returns:HaasomeClientResponse
Returns:In .result List[str] of all the prices sources
get_enabled_price_sources()

Returns all enabled price sources

Returns:HaasomeClientResponse
Returns:In .result List[str] of all the enabled sources
get_history(pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str, interval: int, depth: int)

Get price history from price servers

Parameters:
  • pricesourceEnumPriceSource: Price Source (Exchange) to get ticker from
  • primarycoin – str: Primary currency Ex. If BNB/BTC then set this to BNB
  • secondarycoin – str: Secondary currency Ex. If BNB/BTC then set this to BTC
  • contractname – str: Contract Name (Optional)
  • interval – int: The candle interval value Ex. 1,2,3,5,15,30,etc (In minutes)
  • depth – int: The depth or how many candles to get
Returns:

HaasomeClientResponse

Returns:

In .result List[PriceTick]: List of Price Tick objects

get_history_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market, interval: int, depth: int)

Get price history from price servers using market object

Parameters:
  • marketMarket: Market object to use
  • interval – int: The candle interval value Ex. 1,2,3,5,15,30,etc (In minutes)
  • depth – int: The depth or how many candles to get
Returns:

HaasomeClientResponse

Returns:

In .result List[PriceTick]: List of Price Tick objects

get_last_trades(pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str)

Returns trade history for the specified market

Parameters:
  • pricesourceEnumPriceSource: Price Source (Exchange) to get ticker from
  • primarycoin – str: Primary currency Ex. If BNB/BTC then set this to BNB
  • secondarycoin – str: Secondary currency Ex. If BNB/BTC then set this to BTC
  • contractname – str: Contract Name (Optional)
Returns:

HaasomeClientResponse

Returns:

In .result TradeContainer: Trade Container object

get_last_trades_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market)

Returns trade history for the specified market using a market object

Parameters:marketMarket: Market object to use
Returns:HaasomeClientResponse
Returns:In .result TradeContainer: Trade Container object
get_minute_price_ticker(pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str)

Returns a minute price ticker

Parameters:
  • pricesourceEnumPriceSource: Price Source (Exchange) to get ticker from
  • primarycoin – str: Primary currency Ex. If BNB/BTC then set this to BNB
  • secondarycoin – str: Secondary currency Ex. If BNB/BTC then set this to BTC
  • contractname – str: Contract Name (Optional)
Returns:

HaasomeClientResponse

Returns:

In .result PriceTick: Price Tick object

get_minute_price_ticker_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market)

Returns a minute price ticker using a market object

Parameters:marketMarket: Market object to use
Returns:HaasomeClientResponse
Returns:In .result PriceTick: Price Tick object
get_order_book(pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str)

Returns the current order book for specified market

Parameters:
  • pricesourceEnumPriceSource: Price Source (Exchange) to get ticker from
  • primarycoin – str: Primary currency Ex. If BNB/BTC then set this to BNB
  • secondarycoin – str: Secondary currency Ex. If BNB/BTC then set this to BTC
  • contractname – str: Contract Name (Optional)
Returns:

HaasomeClientResponse

Returns:

In .result Orderbook: Orderbook object

get_order_book_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market)

Returns the current order book for specified market using a market object

Parameters:marketMarket: Market object to use
Returns:HaasomeClientResponse
Returns:In .result Orderbook: Orderbook object
get_price_markets(pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource)

Returns markets for specified price source

Parameters:pricesourceEnumPriceSource: Price Source (Exchange)
Returns:HaasomeClientResponse
Returns:In .result List[Market] of markets
get_price_ticker(pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str)

Returns the current price tick object

Parameters:
  • pricesourceEnumPriceSource: Price Source (Exchange) to get ticker from
  • primarycoin – str: Primary currency Ex. If BNB/BTC then set this to BNB
  • secondarycoin – str: Secondary currency Ex. If BNB/BTC then set this to BTC
  • contractname – str: Contract Name (Optional)
Returns:

HaasomeClientResponse

Returns:

In .result PriceTick: Price Tick object

get_price_ticker_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market)

Returns the current price tick object from a market object

Parameters:marketMarket: Market object to use
Returns:HaasomeClientResponse
Returns:In .result PriceTick: Price Tick object