nkaz001 / collect-binancefutures

Collect BinanceFutures's trade and orderbook(depth) feeds.
94 stars 27 forks source link

how to collect data under windows? #2

Closed quant2008 closed 1 year ago

quant2008 commented 1 year ago

Under windows 10, I run python.exe collect/main.py binancefutures btcusdt mnt/data, and I got the folloing error. asyncio doesn't implement some function under windows. I wonder how to collect data under windows?

image

nkaz001 commented 1 year ago

I haven't thought about it running on Windows. If you use WSL or can setup WSL(Windows Subsystem for Linux), then try it on WSL?

nkaz001 commented 1 year ago

Or just delete the line 536, that's about terminating the app when it receives SIGTERM. it has nothing to do with its core function.

quant2008 commented 1 year ago

Thank you very much for your reply. I deleted line 536 and ran again, got the following error.

image

I am in China, I use a vpn proxy to access binancefutures. I guess I need set proxy in aiohttp, but I don't know how. I tried set enviroment variable set http_proxy=http://127.0.0.1:7890 set https_proxy=http://127.0.0.1:7890 but doesn't work.

nkaz001 commented 1 year ago

In that case, you need to set proxy parameter at request and ws_connect methods.

https://github.com/nkaz001/collect-binancefutures/blob/master/collect/binancefutures.py#L106 response = await self.client.request(verb, url, timeout=timeout, proxy='http://127.0.0.1:7890')

https://github.com/nkaz001/collect-binancefutures/blob/master/collect/binancefutures.py#L163 async with session.ws_connect(url, proxy='http://127.0.0.1:7890') as ws:

Please see the following doc.

https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession.ws_connect https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession.request

For the best data quality(to reduce latency), I recommend you running at AWS Tokyo region if possible. the result is significantly affected by latency, depending on the type of strategies used.

quant2008 commented 1 year ago

It's very kind of you. It works now.

quant2008 commented 1 year ago

Hello, I am downloading the data. The downloadded file btcusdt_20230730.dat is becoming bigger and bigger. Now, it's 1.1G and it's still downloading. I wonder when will this download stop?

nkaz001 commented 1 year ago

depending on trading volume day by day, but usually it's a few gb per day.