Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Package that implements a remote client for hummingbot in Python.

License

NotificationsYou must be signed in to change notification settings

hummingbot/hbot-remote-client-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Package that implements a remote client for hummingbot in Python.

You can use this client to implement remote control and monitoring software of multi-botenvironments using the MQTT feature of hummingbot.

Usage

Commands

TheBotCommands class provides methods for calling bot commands.Each instance is bound to a specific bot instance.

def__init__(self,bot_id:str,host:str='localhost',port:int=1883,username:str='',password:str='',namespace:str='hbot',**kwargs             ):

Below is an example of using theBotCommands class to send commands to a bot

importasynciofromhbotrcimportBotListener,BotCommandsasyncdefrun_commands(client):resp=client.start()print(f'Start Command Response:{resp}')resp=client.import_strategy('conf_pure_mm')print(f'Import Command Response:{resp}')awaitasyncio.sleep(1)resp=client.import_strategy('conf_pure_mm_1')print(f'Import Command Response:{resp}')awaitasyncio.sleep(1)resp=client.config([('bid_spread',0.1), ('ask_spread',0.1)])print(f'Config Command Response:{resp}')awaitasyncio.sleep(1)resp=client.start()print(f'Start Command Response:{resp}')awaitasyncio.sleep(1)resp=client.status()print(f'Status Command Response:{resp}')awaitasyncio.sleep(1)resp=client.history()print(f'History Command Response:{resp}')awaitasyncio.sleep(1)resp=client.stop()print(f'Stop Command Response:{resp}')awaitasyncio.sleep(1)if__name__=="__main__":importsysiflen(sys.argv)<2:print('Give instance_id argument')_id=sys.argv[1]client=BotCommands(host='localhost',port=1883,username='',password='',bot_id=_id,    )asyncio.new_event_loop().run_until_complete(run_commands(client))

Monitoring Interfaces

TheBotListener class provides methods for subscribing to notifications,internal events (e.g. market events), logs and heartbeat messages for a specificbot instance.

def__init__(self,host:str='localhost',port:int=1883,username:str='',password:str='',bot_id:str='bot1',namespace:str='hbot',notifications:bool=True,events:bool=True,logs:bool=True,on_notification:Optional[Callable[[NotifyMessage],None]]=None,on_event:Optional[Callable[[EventMessage],None]]=None,on_log:Optional[Callable[[EventMessage],None]]=None,**kwargs

Below is an example of using theBotListener class to listen to bot events andnotifications.

importasynciofromhbotrcimportBotListenerdefon_notification(msg):_text=msg.msgprint(f'[NOTIFICATION] -{_text}')defon_event(msg):print(f'[EVENT] -{event}')if__name__=="__main__":importsysiflen(sys.argv)<2:print('Give instance_id argument')_id=sys.argv[1]client=BotListener(host='localhost',port=1883,username='',password='',bot_id=_id,notifications=True,events=True,logs=True,on_notification=on_notification,on_event=on_event    )asyncio.new_event_loop().run_until_complete(client.run_forever())

Examples

Head to the./examples directory for more examples.

About

Package that implements a remote client for hummingbot in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp