-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
neo1777
committed
Feb 25, 2021
1 parent
af47d7f
commit 380578a
Showing
6 changed files
with
472 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
import 'class_ftx.dart'; | ||
import 'ftx_function_base.dart'; | ||
import 'ftx_request_class.dart'; | ||
import 'package:dotenv/dotenv.dart'; | ||
|
||
Future run() async { | ||
load(); | ||
var ftxApi = ApiProvide(); | ||
var data = PrimitiveWrapper(); | ||
await funzione_market_init(ftxApi, data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'dart:convert'; | ||
import 'class_ftx.dart'; | ||
import 'ftx_request_class.dart'; | ||
import 'package:dotenv/dotenv.dart'; | ||
import 'package:decimal/decimal.dart'; | ||
|
||
var versione = 'v8.02'; | ||
|
||
Future funzione_market_init(ApiProvide ftxApi, PrimitiveWrapper data) async { | ||
var market_single = | ||
await ftxApi.ftx_Get(env['URL_ftx'], 'markets/${env['Cross_ftx']}'); | ||
final market = marketFromMap(json.encode(market_single.data)); | ||
data.increment_base = | ||
Decimal.parse(market.result_m.priceIncrement.toString()); | ||
data.increment = data.increment_base * Decimal.parse(env['distance_ord']); | ||
data.ask_start = market.result_m.ask; | ||
data.bid_start = market.result_m.bid; | ||
data.type = market.result_m.type; | ||
data.sizeIncrement = market.result_m.sizeIncrement.toString(); | ||
data.size_base = | ||
Decimal.parse(env['size']) * Decimal.parse(data.sizeIncrement); | ||
data.size_buy = | ||
Decimal.parse(env['size']) * Decimal.parse(data.sizeIncrement); | ||
data.size_sell = | ||
Decimal.parse(env['size']) * Decimal.parse(data.sizeIncrement); | ||
data.size_add = | ||
Decimal.parse(env['size_add']) * Decimal.parse(data.sizeIncrement); | ||
data.limit_order = data.increment * Decimal.parse(env['limit_order']); | ||
|
||
var wallet_balances = | ||
await ftxApi.ftx_Get_Auth(env['URL_ftx'], 'wallet/balances'); | ||
data.map_limit = await prep_list_orderLimit(data.increment); | ||
var txt = ' π₯π₯ FTX_GridBot_1777${versione} π₯π₯\n'; | ||
txt += '\n'; | ||
txt += ' π Cross start: ${market.result_m.name} π\n'; | ||
txt += '\n'; | ||
txt += 'βοΈ time: ${DateTime.now().toUtc()}\n'; | ||
var i = 0; | ||
while (i < wallet_balances.data['result'].length) { | ||
txt += | ||
'π° bilancio: ${wallet_balances.data['result'][i]['total']} ${wallet_balances.data['result'][i]['coin']}\n'; | ||
|
||
i++; | ||
} | ||
txt += '\n'; | ||
var currency; | ||
if (data.type == 'spot') { | ||
currency = market.result_m.baseCurrency.toString(); | ||
} else { | ||
currency = 'USD'; | ||
} | ||
|
||
txt += | ||
'hai impostato una size di ${env['size']} che corrisponde a ${data.size_base} ${currency} per un totale di ${int.parse(env['n_order']) * 2} ordini (max ${int.parse(env['limit_order']) * 2})\n'; | ||
txt += | ||
'la distanza minima tra gli ordini Γ¨ ${Decimal.parse(market.result_m.priceIncrement.toString())} e lo spread attuale Γ¨ ${(market.result_m.ask - market.result_m.bid).toStringAsFixed(10)}\n'; | ||
txt += | ||
'la distanza impostata Γ¨ ${data.increment} che corrisponde a ${env['distance_ord']} volte il minimo e ${data.increment.toDouble() / (market.result_m.ask - market.result_m.bid)} volte lo spread\n'; | ||
if (data.increment.toDouble() / (market.result_m.ask - market.result_m.bid) < | ||
2) { | ||
txt += | ||
'\n β οΈβ οΈ si consiglia di mantenere una distanza tra gli ordini superiore al doppio dello spread β οΈβ οΈ\n'; | ||
} | ||
if (env['trading'] == 'false') { | ||
txt += | ||
'se le impostazioni ti soddisfano, attiva il trading sul file .env e riavviami π€\n'; | ||
} | ||
if (env['trading'] == 'true') { | ||
txt += '\n'; | ||
txt += 'il trading π€ Γ¨ ATTIVATO\n'; | ||
|
||
txt += 'TO THE MππN !!\n'; | ||
txt += 'πππ \n'; | ||
} | ||
print(txt); | ||
} | ||
|
||
Future<Map> prep_list_orderLimit(Decimal increment) async { | ||
var map = {}; | ||
while (map.length + 1 <= int.parse(env['n_order'])) { | ||
map.addAll({ | ||
'${map.length + 1}': '${Decimal.fromInt(map.length + 1) * increment}' | ||
}); | ||
} | ||
return map; | ||
} |
Oops, something went wrong.