Binance Futures error with lot of Assets

Posted By: NorbertSz

Binance Futures error with lot of Assets - 03/17/22 07:47

Hi all,

I want to analyze all of the avaliable USDT/BUSD instruments on Binance Futures. I made a simple script that generates the AssetsBinance.csv day-to-day, by just pulling the public fapi exchangeInfo:
Code
https://www.binance.com/fapi/v1/exchangeInfo

I've made a test Zorro script to see how it look like when I'm connecting to Binance Futures.

==== TLDR; ====

There are a lot of assets, and during the websocket subscribing, at some point it stops working, for example:
Code
!RSRUSDT: Subscribing...
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!RSRUSDT: Subscription failure: Book
Error 053: RSRUSDT unavailable at this time


The problem isn't what the log says, because if I put these problematic assets in the top of the AssetsBinance (and restarts Zorro), it connects flawlessly - the asset IS avaliable. So it should be something about the amount of assets.

Is there a trick that I can do for working with this scale?

Thank you!

==== DETALIS ====

Accounts.csv:
Code
Name,Broker,AccountId,User,Pass,Assets,CCY,Real,NFA,Plugin
binance,wss://fstream.binance.com,USDT,(key),(secret),AssetsBinance,USDT,1,14,BinanceFutures


AssetsBinance.csv:
Code
Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Leverage,LotAmount,Commission
AXSUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ALPHAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BTCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ETHUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BCHUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
XRPUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
EOSUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LTCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
TRXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ETCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LINKUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
XLMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ADAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
XMRUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DASHUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ZECUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
XTZUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BNBUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ATOMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ONTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
IOTAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BATUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
VETUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
NEOUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
QTUMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
IOSTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
THETAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ALGOUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ZILUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
KNCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ZRXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
COMPUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
OMGUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DOGEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SXPUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
KAVAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BANDUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BANDUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
RLCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
WAVESUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
MKRUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SNXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DOTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DEFIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
YFIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BALUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CRVUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
TRBUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
YFIIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
RUNEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SUSHIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SRMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
EGLDUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SOLUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ICXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
STORJUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BLZUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
UNIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
AVAXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
FTMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
HNTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ENJUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
FLMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
TOMOUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
RENUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
KSMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
NEARUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
AAVEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
FILUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
RSRUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LRCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
MATICUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
OCEANUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CVCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BELUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CTKUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ZENUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SKLUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
GRTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
1INCHUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BTCBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
AKROUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CHZUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SANDUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ANKRUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LUNAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BTSUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LITUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
UNFIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DODOUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
REEFUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
RVNUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SFPUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
XEMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BTCSTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
COTIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CHRUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
MANAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ALICEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
HBARUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ONEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LINAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
STMXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DENTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CELRUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
HOTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
MTLUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
OGNUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
NKNUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DGBUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
1000SHIBUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ICPUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BAKEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
GTCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ETHBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BTCDOMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
TLMUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BNBBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ADABUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
XRPBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
IOTXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DOGEBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
AUDIOUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
RAYUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
C98USDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
MASKUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ATAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
SOLBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
FTTBUSD,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DYDXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
1000XECUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
GALAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CELOUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ARUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
KLAYUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ARPAUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
CTSIUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
LPTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ENSUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
BTCUSDT_220325,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ETHUSDT_220325,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
PEOPLEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ANTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ROSEUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
DUSKUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
1000BTTCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
FLOWUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
IMXUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
API3USDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
ANCUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1
GMTUSDT,0.01,0.0001,0,0,0.000001,0.000001,0,1,1,-0.1


testConnection.c Zorro Code:
Code
function run(){
	set(LOGFILE);
	setf(PlotMode, PL_LONG+PL_FINE+PL_FILE+PL_ALL);
	LookBack = 100;
	StartDate = NOW;
	Verbose = 7+DIAG;
	while(loop(Assets)){
		asset(Loop1);
		if (!is(LOOKBACK)){
			printf("- %s %0.6f\n", Asset, priceClose());
		}
	}
}


When I try this with just some assets it works fine, I see a lot of these records:
Code
...
!FLMUSDT: Subscribing...
Warning 054: FLMUSDT PIP 0.000001000 -> 0.0001000!
BrokerHistory FLMUSDT: 1201 ms
!FLMUSDT 02-13 03:10:52 to 03-17 07:10:52
!=> 03-10 00:00:00 to 03-17 07:00:00, 176 ticks
Load FLMUSDT prices..
BrokerHistory FLMUSDT: 2147 ms
!FLMUSDT 02-13 03:10:52 to 03-09 23:30:00
!=> 03-02 16:00:00 to 03-09 23:00:00, 176 ticks 352 h
FLMUSDT 352 ticks read
FLMUSDT: 0..9117

!TOMOUSDT: Subscribing...
Warning 054: TOMOUSDT PIP 0.000001000 -> 0.0001000!
BrokerHistory TOMOUSDT: 1902 ms
!TOMOUSDT 02-13 03:10:56 to 03-17 07:10:56
!=> 03-10 00:00:00 to 03-17 07:00:00, 176 ticks
Load TOMOUSDT prices..
BrokerHistory TOMOUSDT: 962 ms
!TOMOUSDT 02-13 03:10:56 to 03-09 23:30:00
!=> 03-02 16:00:00 to 03-09 23:00:00, 176 ticks 352 h
TOMOUSDT 352 ticks read
TOMOUSDT: 0..9117
...


Then at some point, this is getting started:

Code
...
!NEARUSDT: Subscribing...
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!NEARUSDT: Subscription failure: BookDepthPartial
Error 053: NEARUSDT unavailable at this time
!FEED_WS: readloop_handler: unspecified system error
!BrokerAsset: stopped
Error 053: AAVEUSDT unavailable at this time
!FILUSDT: Subscribing...
!FILUSDT: Subscription failure: BookDepthPartial
Error 053: FILUSDT unavailable at this time
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!RSRUSDT: Subscribing...
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!RSRUSDT: Subscription failure: Book
Error 053: RSRUSDT unavailable at this time
!LRCUSDT: Subscribing...
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!LRCUSDT: Subscription failure: Book
Error 053: LRCUSDT unavailable at this time
!MATICUSDT: Subscribing...
...


Sometimes there are some success in the middle of these unseccessful connects (SKLUSDT):
Code
!ZENUSDT: Subscribing...
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!ZENUSDT: Subscription failure: Book
Error 053: ZENUSDT unavailable at this time
!SKLUSDT: Subscribing...
Warning 054: SKLUSDT PIP 0.000001000 -> 0.00001000!
BrokerHistory SKLUSDT: 1219 ms
!SKLUSDT 02-13 03:21:03 to 03-17 07:21:03
!=> 03-10 00:00:00 to 03-17 07:00:00, 176 ticks
Load SKLUSDT prices..
BrokerHistory SKLUSDT: 1873 ms
!SKLUSDT 02-13 03:21:03 to 03-09 23:30:00
!=> 03-02 16:00:00 to 03-09 23:00:00, 176 ticks 352 h
SKLUSDT 352 ticks read
SKLUSDT: 0..9117
!GRTUSDT: Subscribing...
!GRTUSDT: Subscription failure: Book
Error 053: GRTUSDT unavailable at this time
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: unspecified system error
!BrokerAsset: stopped
Error 053: 1INCHUSDT unavailable at this time


So as mentioned above, the problem isn't what the log says, because if I put these problematic assets in the top of the AssetsBinance (and restarts Zorro), it connects flawlessly - the asset IS avaliable. So it should be something about the amount of assets.

Is there a trick that I can do for working with this scale?

Thank you!
Posted By: AndrewAMD

Re: Binance Futures error with lot of Assets - 03/17/22 12:02

The Binance Futures plugin supports up to 66 assets. This is because each asset consumes 3 subscriptions, and the server supports up to 200 subscriptions.

The solution is to run multiple Zorros as needed.
Posted By: NorbertSz

Re: Binance Futures error with lot of Assets - 03/17/22 13:44

Ouch, I didn't see any information about this restriction nor in the Zorro help nor in the Binance Futures API general info. I'll ask the support for make a remark for the Binance Futures plugin details. Thank you!
Posted By: NorbertSz

Re: Binance Futures error with lot of Assets - 03/17/22 15:02

I can't run multiple Zorro instances with Binance Futures plugin, but asked it in a new thread to make it easier to find for the future:
https://opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=485489

@AndrewAMD I guess you have experience with this problem; could you check that thread? Thank you!
Posted By: ztests

Re: Binance Futures error with lot of Assets - 03/04/23 15:07

Hi All,

I have a similar problem with Binance futures and “many” assets.

The code below works fine (-at least it runs for a few hours...) using 3 assets but it breaks quite quickly with 8!

I worked with the latest Zorro Beta (2.55.6b) and the Binance Futures plugin version is 1.0.3.1.

The code

Code
-----------------------------------------------------------------------------------------------------------------------------
#include <profile.c>

#define MAX_ACTIVE_SYMBOLS 50
string ActiveSymbols[MAX_ACTIVE_SYMBOLS];

#define SYMBOLS_TEST_WORKS "BTCUSDT","ETHUSDT","BNBUSDT"
#define SYMBOLS_TEST_FAILS "BTCUSDT","ETHUSDT","BNBUSDT","XRPUSDT","LINKUSDT","DOTUSDT","LTCUSDT","ADAUSDT"
#define SYMBOLS SYMBOLS_TEST_FAILS

static int NUM_SYMBOLS = 0;

function tock()
{
	if (!is(LOOKBACK))
	{
	    string tdate = strf("%04i-%02i-%02i %02i:%02i", year(), month(), day(), hour(), minute());
	    printf("\n\n[%i - %s] Checking the Bin-sever %f ... \n", Bar, tdate, brokerCommand(2002,0) );
    
	    if(brokerCommand(2002,0) > 90000.0)
		{
			printf("\n\n[%i - %s] ------------ fixing connection \n", Bar, tdate );
                        brokerCommand(2001,0);
		} 
	}

	return;
}


function run()
{
	set(TICKS, LOGFILE, NFA);

	resf(BarMode, BR_WEEKEND);
	setf(BarMode, BR_FLAT);

	StartDate = 2021;
	EndDate = 2023;

    BarPeriod = 1440;
        
	LookBack = 50; 
	
	TickTime = 500;
	TockTime = 60000;

	Verbose = 3;

    Capital = 1000 * 1000;


	// History = "C:\\co\\adata\\crypto_daily\\binance\\spot\\*.t6";
	// History = "C:\\co\\adata\\crypto_daily\\binance\\um\\*.t6";
	History = "C:\\co\\adata\\crypto_futures\\binance\\um\\*.t6";
	
	
	if (is(FIRSTINITRUN)) {
		
		assetList("AssetsBinanceFutUM");
		
		NUM_SYMBOLS = 0;
		string temp_str;
		while( temp_str = of(SYMBOLS) ){

		    ActiveSymbols[NUM_SYMBOLS] = temp_str;

		    ++NUM_SYMBOLS;

		    if (NUM_SYMBOLS > MAX_ACTIVE_SYMBOLS)
                       quit("Error - array index value !");			
		}
		
		printf("\nFIRSTINITRUN: %d active symbols\n", NUM_SYMBOLS);
	}


    if (is(TRADEMODE))
	{
	    string tdate = strf("%04i-%02i-%02i %02i:%02i", year(), month(), day(), hour(), minute());
	    if (is(LOOKBACK))
		    printf("\n\n[%i - %s] New day in LOOKBACK\n", Bar, tdate );
	    else
		    printf("\n\n[%i - %s] New day in trading\n", Bar, tdate );
	}

    int i = 0;
    int longs = 0;
	int shorts = 0;
	for (i = 0; i < NUM_SYMBOLS; i++) {
		asset(ActiveSymbols[i]);

		if(is(INITRUN)) 
	    { 
            if (is(TRADEMODE))
		    {
                printf("\nTaking a nap for a minute... ");
                Sleep(1000 * 30);
                printf("waking up!\n");	
		    }
		}		
		vars myclose = series(priceClose());
	}
}
-----------------------------------------------------------------------------------------------------------------------------


The log file:
-----------------------------------------------------------------------------------------------------------------------------

...

[0 - 0000-00-00 00:00] New day in LOOKBACK

!BTCUSDT: Subscribing...
Warning 054: BTCUSDT LotAmount 1.0 -> 0.0010
Warning 054: BTCUSDT PIP 0.000001000 -> 0.1000
!BTCUSDT 12-04 00:11:51 to 03-04 12:11:51
!=> 03-03 11:13:00 to 03-04 12:12:00, 1500 ticks
Load BTCUSDT prices..
!BTCUSDT 12-04 00:11:51 to 03-03 11:12:30
!=> 03-02 10:14:00 to 03-03 11:13:00, 1500 ticks 110927 min
BTCUSDT 110927 ticks read
76(111292) bars 2022-12-19..2023-03-04 generated
BTCUSDT: 0..111291
Taking a nap for a minute... waking up!

!ETHUSDT: Subscribing...
Warning 054: ETHUSDT LotAmount 1.0 -> 0.0010
Warning 054: ETHUSDT PIP 0.000001000 -> 0.01000
Load ETHUSDT prices.. 110927 min
ETHUSDT 110927 ticks read
ETHUSDT: 0..111291
Taking a nap for a minute... waking up!

...

!ADAUSDT: Subscribing...
Warning 054: ADAUSDT PIP 0.000001000 -> 0.0001000
Load ADAUSDT prices.. 110926 min
ADAUSDT 110926 ticks read
ADAUSDT: 0..111291
Taking a nap for a minute... waking up!

V 2.556 on Sat 23-03-04 04:33:47

LookBack set to 50 bars

...

Lookback 50 bars, 2023-01-14..2023-03-04

[26: Sat 23-01-14 15:40] 1418.40/1644.92\1406.29/1525.33 -0.01

[26 - 2023-01-14 15:40] New day in LOOKBACK
.
[27: Sun 23-01-15 15:40] 1525.33/1564.00\1516.02/1545.63 -0.01

...

[73 - 2023-03-02 15:40] New day in LOOKBACK

[74: Fri 23-03-03 15:40] 1626.89/1657.76\1534.85/1566.33 -0.01

[74 - 2023-03-03 15:40] New day in LOOKBACK

Bar 75 continued until 15:40:00 Sat

End of lookback period at 12:33:54 Sat

[75 - 2023-03-04 12:34] Checking the Bin-sever 8.793820...


[75 - 2023-03-04 12:35] Checking the Bin-sever 1.727340...


[75 - 2023-03-04 12:36] Checking the Bin-sever 1.709770...


[75 - 2023-03-04 12:37] Checking the Bin-sever 11.141770...


[75 - 2023-03-04 12:38] Checking the Bin-sever 19.492480...

...


[75 - 2023-03-04 13:03] Checking the Bin-sever 10.628200...


[75 - 2023-03-04 13:04] Checking the Bin-sever 1.831130...


[75 - 2023-03-04 13:05] Checking the Bin-sever 7.644880...


[75 - 2023-03-04 13:06] Checking the Bin-sever 1.552680...

!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!BrokerAsset: stopped
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints

[75 - 2023-03-04 13:07] Checking the Bin-sever 19.044920...

!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
!FEED_WS: readloop_handler: The WebSocket stream was gracefully closed at both endpoints
...
-----------------------------------------------------------------------------------------------------------------------------


It looks like that the solution "if(brokerCommand(2002,0) > 120000.) brokerCommand(2001,0); " is not catching the problem ???

Have I missed something?

Thank you for your comments!
Posted By: Petra

Re: Binance Futures error with lot of Assets - 03/08/23 09:11

https://zorro-project.com/manual/en/binancefutures.htm

Use the workaround described there.
Posted By: ztests

Re: Binance Futures error with lot of Assets - 03/09/23 06:49

Originally Posted by Petra
https://zorro-project.com/manual/en/binancefutures.htm

Use the workaround described there.


Hi Petra,

thank you for the message.

The above Zorro script implements all the suggested workarounds (namely - "TickTime" and "if(brokerCommand(2002,0) > 120000.) brokerCommand(2001,0);" ) and shows the evidence that (at least) those workarounds are not affective - the script runs perfectly for 30-60 minutes and then... it breaks smile!

Could you be more specific and write what is possibly missing or implemented incorrectly in the above Zorro script?

Maybe you could even post a very simple Zorro program/blueprint that works with 66 assets/coins on Binance Futures for say, 60 minutes and longer?

Thank you very much for your comments!
© 2024 lite-C Forums