Step-by-step guide on how code editor works

This guide is made to explain functional logic for writing continuous scripts.

Use case

Code editor is made in advance to build trading cycles on binance. Editors sintax is customaized in a way to make interraction with binance easier without extra lines of code to recieve or send simple things.

Cases we will walk trought

Authorization key placement in local storage.

Geathering and using data from binance.

Writing simple convertion tool for registered market on binance.

Final result of this guide

BIT BLOCK

Lets walk trought authorization key initialization.

You have to prepare binance keys before you open code editor. Once you open app, app will collect your account information. If no data if provided before it will notify you don't have an access and prompt will be displayed.

BIT BLOCK

Built-in functions used in this example

concat() - used to log strings

roundDown() - used to adjust number to specific decimal points

if() - used to build expression

Lets enable settings for binance

We have to enable base settings to recieve market and account information, each data is geathered on it's own interval. They are built in and regulated to recieve price often and information that does not need to change so ofter longer.

BIT BLOCK

Basic example of asset converter

At first we have to prepare definitions so we have data to work with. To convert assets we will need ticker we enabled before, wallet balances, 24 hour change to know where we are headed and restricted decimal points. Syntax is build in a way to access markets directly so if you want to define BNBUSDT market, you have to call it directly.

BIT BLOCK

Converting both assets in paralel

We are using roundDown() function in this example, to adapt to decimal points, based on market. We are muliplying base asset and deviding quote asset. Once you defined one of sides, they will be recalculated on every time market information is geathered.

BIT BLOCK

Creating conditional definitions

If we want to know directly wich of both assets have larger buying power based on your current asset value, we have to compare portitions and return data based on condition.

BIT BLOCK

Congratulations, you have created asset converter and you can save it to filesystem.

BIT BLOCK