alpacahq / pipeline-live

Pipeline Extension for Live Trading
https://pypi.org/project/pipeline-live/
Apache License 2.0
204 stars 56 forks source link

Reuse sessions for Alpaca API calls #30

Closed jbussdieker closed 3 years ago

jbussdieker commented 3 years ago

I haven't fully tested this but I think this will fix these warning and make better use of http sessions:

pipeline_live/data/sources/alpaca.py:31: ResourceWarning: unclosed <ssl.SSLSocket fd=123, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('1.2.3.4', 1234), raddr=('34.86.145.125', 443)>
  barset = tradeapi.REST().get_barset(symbols, timespan, limit)
shlomiku commented 3 years ago

code verified