Hi!
I am new to Trio (and to async) and am trying to incorporate this library into my trading program, which uses Alpaca Trading API. When I am running this small test:
import trio
import trade_class as TC
from datetime import datetime
from os import path
async def my_sleep():
sym = 'AAPL'
barset = tc.api.get_barset(sym, '1Min', limit=50 * 6.5 * 7, end=datetime.now())[sym]
return barset
async def child(i):
print(f" child{i}: started! sleeping now...")
await trio.sleep(5)
print(f" child{i}: exiting!")
async def parent():
print("parent: started!")
async with trio.open_nursery() as nursery:
for i in range(1, 3):
print(f"parent: spawning child{i}...")
nursery.start_soon(child, i)
print("parent: waiting for children to finish...")
# -- we exit the nursery block here --
print("parent: all done!")
FULL_DATA_FOLDER = path.join(path.dirname(path.abspath(__file__)), 'data')
key_filename = path.join(FULL_DATA_FOLDER, 'key1.txt')
tc = TC.Alpaca_Obj(key_filename)
trio.run(parent)
– I get the following error:
c:\users\gil\envs\utils\lib\site-packages\trio\_core\_wakeup_socketpair.py:70: RuntimeWarning: It looks like Trio's signal handling code might have collided with another library you're using. If you're running Trio in guest mode, then this might mean you should set host_uses_signal_set_wakeup_fd=True. Otherwise, file a bug on Trio and we'll help you figure out what's going on.
I think the Alpaca API uses async/websockets, but I don’t invoke these in my own code.
With thanks!
Gil