haasomeapi.apis.TradeApi module

Functions

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

Bases: haasomeapi.apis.ApiBase.ApiBase

The Trade API Class. Gives access to the trade api endpoints

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

Cancel a pending order

Parameters:
  • accountguid – str: The account guid
  • orderguid – str: Order guid to cancel
Returns:

HaasomeClientResponse

Returns:

In .result bool: If order cancelled succesfully

cancel_template(templateguid: str)

Cancel a pending template order

Parameters:templateguid – str: Template order guid
Returns:HaasomeClientResponse
Returns:In .result bool: If template cancelled succesfully
place_enter_long_order(accountguid: str, primarycoin: str, secondarycoin: str, price: float, amount: float, leverage: float, timeout: int = 0, contractname: str = '', userguid: str = '', templateguid: str = '')

Place a long order for Leverage/Margin

Parameters:
  • accountguid – str: The account guid
  • 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
  • price – float: Price to place order at
  • amount – float: Trade Amount
  • leverage – float: Leverage percentage amount
  • timeout – int: (Default value = 0) Order Timeout in minutes
  • contractname – str: (Default value = “”) Contract name to use
  • userguid – str: (Default value = “”) User guid for order
  • templateguid – str: (Default value = “”) Order template guid to use
Returns:

HaasomeClientResponse

Returns:

In .result str: Template guid

place_enter_short_order(accountguid: str, primarycoin: str, secondarycoin: str, price: float, amount: float, leverage: float, timeout: int = 0, contractname: str = '', userguid: str = '', templateguid: str = '')

Place a short order for Leverage/Margin

Parameters:
  • accountguid – str: The account guid
  • 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
  • price – float: Price to place order at
  • amount – float: Trade Amount
  • leverage – float: Leverage percentage amount
  • timeout – int: (Default value = 0) Order Timeout in minutes
  • contractname – str: (Default value = “”) Contract name to use
  • userguid – str: (Default value = “”) User guid for order
  • templateguid – str: (Default value = “”) Order template guid to use
Returns:

HaasomeClientResponse

Returns:

In .result str: Template guid

place_exit_long_order(accountguid: str, primarycoin: str, secondarycoin: str, price: float, amount: float, leverage: float, timeout: int = 0, contractname: str = '', userguid: str = '', templateguid: str = '')

Place a exit long order for Leverage/Margin

Parameters:
  • accountguid – str: The account guid
  • 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
  • price – float: Price to place order at
  • amount – float: Trade Amount
  • leverage – float: Leverage percentage amount
  • timeout – int: (Default value = 0) Order Timeout in minutes
  • contractname – str: (Default value = “”) Contract name to use
  • userguid – str: (Default value = “”) User guid for order
  • templateguid – str: (Default value = “”) Order template guid to use
Returns:

HaasomeClientResponse

Returns:

In .result str: Template guid

place_exit_short_order(accountguid: str, primarycoin: str, secondarycoin: str, price: float, amount: float, leverage: float, timeout: int = 0, contractname: str = '', userguid: str = '', templateguid: str = '')

Place a exit short order for Leverage/Margin

Parameters:
  • accountguid – str: The account guid
  • 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
  • price – float: Price to place order at
  • amount – float: Trade Amount
  • leverage – float: Leverage percentage amount
  • timeout – int: (Default value = 0) Order Timeout in minutes
  • contractname – str: (Default value = “”) Contract name to use
  • userguid – str: (Default value = “”) User guid for order
  • templateguid – str: (Default value = “”) Order template guid to use
Returns:

HaasomeClientResponse

Returns:

In .result str: Template guid

place_spot_buy_order(accountguid: str, primarycoin: str, secondarycoin: str, price: float, amount: float, timeout: int = 0, userguid: str = '', templateguid: str = '')

Place a spot buy order

Parameters:
  • accountguid – str: The account guid
  • 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
  • price – float: Price to place order at
  • amount – float: Trade Amount
  • timeout – int: (Default value = 0) Order Timeout in minutes
  • userguid – str: (Default value = “”) User guid for order
  • templateguid – str: (Default value = “”) Order template guid to use
Returns:

HaasomeClientResponse

Returns:

In .result str: Template guid

place_spot_sell_order(accountguid: str, primarycoin: str, secondarycoin: str, price: float, amount: float, timeout: int = 0, userguid: str = '', templateguid: str = '')

Place a spot sell order

Parameters:
  • accountguid – str: The account guid
  • 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
  • price – float: Price to place order at
  • amount – float: Trade Amount
  • timeout – int: (Default value = 0) Order Timeout in minutes
  • userguid – str: (Default value = “”) User guid for order
  • templateguid – str: (Default value = “”) Order template guid to use
Returns:

HaasomeClientResponse

Returns:

In .result str: Template guid