|
@@ -1,7 +1,8 @@
|
|
|
const BinanceSpot = require('../binance-spot')
|
|
const BinanceSpot = require('../binance-spot')
|
|
|
const BinanceKit = require('../binance-kit')
|
|
const BinanceKit = require('../binance-kit')
|
|
|
-const logger = require('../../../kit/logger-kit')
|
|
|
|
|
|
|
+const logger = require('../../../kit/logger-kit').getLogger('binance-spot-test')
|
|
|
const Config = require('../../../config/config')
|
|
const Config = require('../../../config/config')
|
|
|
|
|
+const PrivateConfig = require('../../../PrivateConfig')
|
|
|
|
|
|
|
|
async function realPriceTest() {
|
|
async function realPriceTest() {
|
|
|
logger.info('real price test:')
|
|
logger.info('real price test:')
|
|
@@ -11,16 +12,32 @@ async function realPriceTest() {
|
|
|
|
|
|
|
|
async function exchangeInfoTest() {
|
|
async function exchangeInfoTest() {
|
|
|
logger.info('exchange info test:')
|
|
logger.info('exchange info test:')
|
|
|
- const pairs = Object.values(Config.tokenMapping).map(coin => `${coin}${Config.baseToken.symbol}` )
|
|
|
|
|
|
|
+ const pairs = Object.values(Config.tokenMapping).map(coin => `${coin}${Config.baseIerc20Token.symbol}` )
|
|
|
const exchangeInfo = await BinanceSpot.exchangeInfo(pairs)
|
|
const exchangeInfo = await BinanceSpot.exchangeInfo(pairs)
|
|
|
|
|
|
|
|
- logger.info(BinanceKit.parsepriceTickFilterMap(exchangeInfo.symbols))
|
|
|
|
|
|
|
+ logger.info(BinanceKit.parsePriceTickFilterMap(exchangeInfo.symbols))
|
|
|
logger.info('')
|
|
logger.info('')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+async function accountInfoTest(context) {
|
|
|
|
|
+ logger.info('account info test:')
|
|
|
|
|
+
|
|
|
|
|
+ const binanceSpot = context.binanceSpot
|
|
|
|
|
+
|
|
|
|
|
+ const accountInfoRst = await binanceSpot.accountInfo()
|
|
|
|
|
+ const accountAssetMap = BinanceKit.parseBalancesToAccountAssetMap(accountInfoRst.balances)
|
|
|
|
|
+
|
|
|
|
|
+ logger.info(accountAssetMap)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
async function main() {
|
|
async function main() {
|
|
|
- await realPriceTest()
|
|
|
|
|
- await exchangeInfoTest()
|
|
|
|
|
|
|
+ const context = {}
|
|
|
|
|
+
|
|
|
|
|
+ context.binanceSpot = new BinanceSpot(PrivateConfig.binanceAPIKey, PrivateConfig.binanceSecretKey)
|
|
|
|
|
+
|
|
|
|
|
+ // await realPriceTest()
|
|
|
|
|
+ // await exchangeInfoTest()
|
|
|
|
|
+ await accountInfoTest(context)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
main()
|