haasomeapi.apis.TradeBotApi module¶
Functions¶
-
class
haasomeapi.apis.TradeBotApi.
TradeBotApi
(connectionstring: str, privatekey: str)¶ Bases:
haasomeapi.apis.ApiBase.ApiBase
The Trade Bot API Class. Gives access to the trade bot api endpoints
Parameters: - connectionstring – str: Connection String Formatted Ex. http://127.0.0.1:9000
- privatekey – str: Private Key Set In The Haas Settings
-
activate_trade_bot
(botguid: str)¶ Activates a trade bot
Parameters: botguid – str: Trade bot guid Returns: HaasomeClientResponse
Returns: In .result bool: If activation was successful
-
add_indicator
(botguid: str, indicatortype: haasomeapi.enums.EnumIndicator.EnumIndicator)¶ Add Indicator to trade bot
Parameters: - botguid – str: Trade bot guid to modify
- indicatortype –
EnumIndicator
: Indicator type
Returns: Returns: In .result
TradeBot
: Trade Bot
-
add_insurance
(botguid: str, insurancetype: haasomeapi.enums.EnumInsurance.EnumInsurance)¶ Add Insurance to trade bot
Parameters: - botguid – str: Trade bot guid to modify
- insturancetype –
EnumInsurance
: Insurance type
Returns: Returns: In .result
TradeBot
: Trade Bot
-
add_safety
(botguid: str, safetytype: haasomeapi.enums.EnumSafety.EnumSafety)¶ Add Safety to trade bot
Parameters: - botguid – str: Trade bot guid to modify
- safetytype –
EnumSafety
: Safety type
Returns: Returns: In .result
TradeBot
: Trade Bot
-
backtest_trade_bot
(botguid: str, minutes: int)¶ Backtest a Trade bot (Note: This function will will make a request to the exchange so don’t call to often)
Parameters: - botguid – str: Custom bot guid
- minutestotest – int: Amount of minutes to test in the past
Returns: Returns: In .result
TradeBot
: Tradebot object
-
backtest_trade_bot_unix_time
(botguid: str, startUnix: int, endUnix: int)¶ Backtest a Trade bot (Note: This function will make a request to the exchange so don’t call to often)
Parameters: - botguid – str: Custom bot guid
- startunix – int: Start time in unix time notation
- endunix – int: End time in unix time notation
Returns: Returns: In .result
TradeBot
: Trade bot object
-
clean_trade_bot
(botguid: str)¶ Clears Trade bot history
Parameters: botguid – str: Custom bot guid Returns: HaasomeClientResponse
Returns: In .result TradeBot
: Trade Bot
-
clone_indicator
(botguid: str, elementguid: str, tobotguid: str)¶ Clone Indicator
Parameters: - botguid – str: Trade bot guid to copy from
- elementguid – str: Element Guid to copy
- tobotguid – str: Trade bot guid to copy to
Returns: Returns: In .result
TradeBot
: Trade Bot
-
clone_insurance
(botguid: str, elementguid: str, tobotguid: str)¶ Clone Insurance
Parameters: - botguid – str: Trade bot guid to copy from
- elementguid – str: Element Guid to copy
- tobotguid – str: Trade bot guid to copy to
Returns: Returns: In .result
TradeBot
: Trade Bot
-
clone_safety
(botguid: str, elementguid: str, tobotguid: str)¶ Clone Safety
Parameters: - botguid – str: Trade bot guid to copy from
- elementguid – str: Element Guid to copy
- tobotguid – str: Trade bot guid to copy to
Returns: Returns: In .result
TradeBot
: Trade Bot
-
clone_trade_bot
(accountguid: str, botguid: str, botname: str, primarycoin: str, secondarycoin: str, contractname: str, leverage: float, copysafeties: bool, copyindicators: bool, copyinsurances: bool, copyparameters: bool, copymarkettoelements: bool)¶ Clone Trade Bot
Parameters: - accountguid – str: Account guid
- botguid – str: Trade bot guid to modify
- botname – str: Name for the new custom bot
- 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)
- leverage – float: Leverage percentage to use (Optional)
- copysafeties – bool: Copy Safeties
- copyindicators – bool: Copy indicators
- copyinsurances – bool: Copy insurances
- copyparameters – bool: Copy parameters
- copymarkettoelements – bool: Copy market to elements
Returns: Returns: In .result
TradeBot
: Trade Bot
-
deactivate_trade_bot
(botguid: str)¶ Deactivates a trade bot
Parameters: botguid – str: Trade bot guid Returns: HaasomeClientResponse
Returns: In .result bool: If activation was successful
-
edit_bot_indicator_settings
(botguid: str, elementguid: str, fieldno: int, value: any)¶ Edit trade bot indicator setting
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- fieldno – int: Field Number to modify
- value – any: Value for field
Returns: Returns: In .result
TradeBot
: Trade Bot
-
edit_bot_insurance_settings
(botguid: str, elementguid: str, fieldno: int, value: any)¶ Edit trade bot insurance setting
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- fieldno – int: Field Number to modify
- value – any: Value for field
Returns: Returns: In .result
TradeBot
: Trade Bot
-
edit_bot_safety_settings
(botguid: str, elementguid: str, fieldno: int, value: any)¶ Edit trade bot safety setting
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- fieldno – int: Field Number to modify
- value – any: Value for field
Returns: Returns: In .result
TradeBot
: Trade Bot
-
get_all_trade_bots
()¶ Returns all trade bots created
Returns: HaasomeClientResponse
Returns: In .result List[ TradeBot
]
-
get_trade_bot
(botguid: str)¶ Returns trade bot matching guid
Parameters: botguid – str: the bot guid Returns: HaasomeClientResponse
Returns: In .result TradeBot
: Trade Bot
-
lock_trade_bot
(botguid: str, lockbot: bool)¶ Locks a Trade bot
Parameters: - botguid – str: Trade bot guid
- lockbot – bool: Lock bot
Returns: Returns: In .result bool: If removal was succesfull
-
new_trade_bot
(accountguid: str, botname: str, primarycoin: str, secondarycoin: str, contractname: str, leverage: float, groupid: str)¶ Create a new trade bot
Parameters: - accountguid – str: Account guid
- botname – str: Name for the new custom bot
- 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)
- leverage – float: Leverage percentage to use (Optional)
- groupid – str: Group id for bot (Optional)
Returns: Returns: In .result
TradeBot
: Trade Bot
-
remove_indicator
(botguid: str, elementguid: str)¶ Remove Indicator from trade bot
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: The element guid to remove
Returns: Returns: In .result
TradeBot
: Trade Bot
-
remove_insurance
(botguid: str, elementguid: str)¶ Remove Insurance from trade bot
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: The element guid to remove
Returns: Returns: In .result
TradeBot
: Trade Bot
-
remove_safety
(botguid: str, elementguid: str)¶ Remove Safety from trade bot
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: The element guid to remove
Returns: Returns: In .result
TradeBot
: Trade Bot
-
remove_trade_bot
(botguid: str)¶ Removes (deletes) Trade bot
Parameters: botguid – str: Trade bot guid Returns: HaasomeClientResponse
Returns: In .result bool: If removal was succesfull
-
setup_indicator
(botguid: str, elementguid: str, pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str, interval: int, charttype: haasomeapi.enums.EnumPriceChartType.EnumPriceChartType, delay: int)¶ Modify trade bot indicator
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- pricesource –
EnumPriceSource
: Price Source (Exchange) for indicator to use - 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: Interval in minutes
- pricesource –
EnumPriceChartType
: Price Chart for indicator to use - delay – int: Delay in minutes
Returns: Returns: In .result
TradeBot
: Trade Bot
-
setup_indicator_leverage_signals
(botguid: str, elementguid: str, uselongsignals: bool, useshortsignals: bool, usenopositionsignals: bool, reversesignals: bool, standalone: bool, mappedbuysignal: haasomeapi.enums.EnumFundPosition.EnumFundPosition, mappedsellsignal: haasomeapi.enums.EnumFundPosition.EnumFundPosition)¶ Modify indicator leverage signals
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- uselongsignals – bool: Use long signals
- useshortsignals – bool: Use short signals
- usenopositionsignals – bool: Use no position signals
- reversesignals – bool: Reverse signals
- standalone – bool: Stand alone
- mappedbuysignal –
EnumFundPosition
: Mapped buy signal position - mappedsellsignal –
EnumFundPosition
: Mapped sell signal position
Returns: Returns: In .result
TradeBot
: Trade Bot
-
setup_indicator_spot_signals
(botguid: str, elementguid: str, usebuysignal: bool, usesellsignal: bool, reversesignals: bool, standalone: bool)¶ Modify indicator spot signal
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- usebuysignal – bool: Use buy signal
- usesellsignal – bool: Use sell signal
- reversesignals – bool: Reverse Signals
- standalone – bool: Stand alone
Returns: Returns: In .result
TradeBot
: Trade Bot
-
setup_leverage_bot_trade_amount
(botguid: str, coinposition: haasomeapi.enums.EnumFundPosition.EnumFundPosition, tradeamount: float, lastlongprice: float, lastshortprice: float, entertemplateid: str, exittemplateid: str, highspeedenabled: bool, allin: bool, ordertimeout: int, templatetimeout: int, maxtradeamount: bool, limitordertype: haasomeapi.enums.EnumLimitOrderPriceType.EnumLimitOrderPriceType, usehiddenorders: bool, fee: float)¶ Modify leverage/margin trade bot amount
Parameters: - botguid – str: Trade bot guid to modify
- coinposition –
EnumCoinPosition
: Coin position - tradeamount – float: Trade Amount
- lastlongprice – float: Last long price
- lastshortprice – float: Last short price
- entertemplateid – str: Enter template guid
- exittemplateid – str: Exit template guid
- highspeedenabled – bool: High speed enabled
- allin – bool: All in trades
- ordertimeout – int: Order timeout in minutes
- templatetimeout – int: Template timeout in minutes
- maxtradeamount – bool: Use max trade amount
- limitordertype –
EnumLimitOrderPriceType
: Limit order type - usehiddenorders – bool: Use hidden orders
- fee – float: Fee percentage to be used in calculations
Returns: Returns: In .result
TradeBot
: Trade bot object
-
setup_safety
(botguid: str, elementguid: str, pricesource: haasomeapi.enums.EnumPriceSource.EnumPriceSource, primarycoin: str, secondarycoin: str, contractname: str, mappedbuysignal: haasomeapi.enums.EnumFundPosition.EnumFundPosition, mappedsellsignal: haasomeapi.enums.EnumFundPosition.EnumFundPosition, validpositionsignal: haasomeapi.enums.EnumSafetyPositionSignal.EnumSafetyPositionSignal)¶ Modify trade bot safety
Parameters: - botguid – str: Trade bot guid to modify
- elementguid – str: Element guid to modify
- pricesource –
EnumPriceSource
: Price Source (Exchange) for indicator to use - 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)
- mappedbuysignal –
EnumFundPosition
: Mapped buy signal position - mappedsellsignal –
EnumFundPosition
: Mapped sell signal position - validpositionsignal –
EnumSafetyPositionSignal
: Mapped Position Signal
Returns: Returns: In .result
TradeBot
: Trade Bot
-
setup_spot_bot_trade_amount
(botguid: str, coinposition: haasomeapi.enums.EnumCoinPosition.EnumCoinPosition, tradeamount: float, lastbuyprice: float, lastsellprice: float, buytemplateid: str, selltemplateid: str, highspeedenabled: bool, allin: bool, ordertimeout: int, templatetimeout: int, maxtradeamount: bool, limitordertype: haasomeapi.enums.EnumLimitOrderPriceType.EnumLimitOrderPriceType, usehiddenorders: bool, fee: float)¶ Modify spot trade bot amount
Parameters: - botguid – str: Trade bot guid to modify
- coinposition –
EnumCoinPosition
: Coin position - tradeamount – float: Trade Amount
- lastbuyprice – float: Last buy price
- lastsellprice – float: Last sell price
- buytemplateid – str: Buy template guid
- selltemplateid – str: Sell template guid
- highspeedenabled – bool: High speed enabled
- allin – bool: All in trades
- ordertimeout – int: Order timeout in minutes
- templatetimeout – int: Template timeout in minutes
- maxtradeamount – bool: Use max trade amount
- limitordertype –
EnumLimitOrderPriceType
: Limit order type - usehiddenorders – bool: Use hidden orders
- fee – float: Fee percentage to be used in calculations
Returns: Returns: In .result
TradeBot
: Trade bot object
-
setup_trade_bot
(accountguid: str, botguid: str, botname: str, primarycoin: str, secondarycoin: str, contractname: str, leverage: float, groupid: str, useconsensus: bool, copymarketstoelements: bool)¶ Modify a trade bot
Parameters: - accountguid – str: Account guid
- botname – str: Name for the new custom bot
- botguid – str: Trade bot guid to modify
- 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)
- leverage – float: Leverage percentage to use (Optional)
- groupid – str: Group id for bot (Optional)
- useconsensus – bool: Use consensus mode
- copymarketstoelements – bool: Copy markets to elements
Returns: Returns: In .result
TradeBot
: Trade bot object
-
switch_bot_coin_position_with_order
(botguid: str, templateguid: str)¶ Switch trade bot coin poisiton with order (Spot Market)
Parameters: - botguid – str: Trade bot guid to modify
- templateguid – str: Order template guid
Returns: Returns: In .result
TradeBot
: Trade Bot
-
switch_bot_funds_position
(botguid: str, position: haasomeapi.enums.EnumFundPosition.EnumFundPosition)¶ Switch trade bots funds position (Leverage/Margin Market)
Parameters: - botguid – str: Trade bot guid to modify
- position –
EnumFundPosition
: Fund position to change to
Returns: Returns: In .result
TradeBot
: Trade Bot
-
switch_bot_funds_position_with_order
(botguid: str, templateguid: str, targetposition: haasomeapi.enums.EnumFundPosition.EnumFundPosition)¶ Switch trade bot coin poisiton with order (Leverage/Margin Market)
Parameters: - botguid – str: Trade bot guid to modify
- templateguid – str: Order template guid
- targetposition –
EnumFundPosition
: Fund position to change to
Returns: Returns: In .result
TradeBot
: Trade Bot
-
switch_coin_positions
(botguid: str, position: haasomeapi.enums.EnumCoinPosition.EnumCoinPosition)¶ Switch trade bots coin position (Spot Market)
Parameters: - botguid – str: Trade bot guid to modify
- position –
EnumFundPosition
: Coin position to change to
Returns: Returns: In .result
TradeBot
: Trade Bot