@lunch-money/binance-to-lunch-money
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -26,16 +26,5 @@ "use strict"; | ||
const client = binanceClientConstructor(Object.assign({}, config)); | ||
const snapshot = yield client.accountSnapshot({ | ||
// We only query for spot traded token balances. Note that we can also | ||
// query for margin and future trading balances, but how that would be | ||
// displayed in Lunch Money is a more complicated question. | ||
type: 'SPOT', | ||
}); | ||
// Status code other than 200 means error, c.f. | ||
// https://github.com/Ashlar/binance-api-node#dailyAccountSnapshot | ||
if (snapshot.code !== 200) { | ||
throw new Error(`Attempt to query for Binance account balance returned ` + | ||
`non-200 status code ${snapshot.code} with message ${snapshot.msg}.`); | ||
} | ||
const balances = snapshot.snapshotVos | ||
.flatMap((v) => v.data.balances) | ||
const snapshot = yield client.accountInfo(); | ||
const balances = snapshot.balances | ||
.filter((v) => Number(v.locked) !== 0 || Number(v.free) !== 0) | ||
.map((b) => ({ | ||
@@ -42,0 +31,0 @@ asset: b.asset, |
@@ -8,16 +8,5 @@ import { default as Binance } from 'binance-api-node'; | ||
const client = binanceClientConstructor({ ...config }); | ||
const snapshot = await client.accountSnapshot({ | ||
// We only query for spot traded token balances. Note that we can also | ||
// query for margin and future trading balances, but how that would be | ||
// displayed in Lunch Money is a more complicated question. | ||
type: 'SPOT', | ||
}); | ||
// Status code other than 200 means error, c.f. | ||
// https://github.com/Ashlar/binance-api-node#dailyAccountSnapshot | ||
if (snapshot.code !== 200) { | ||
throw new Error(`Attempt to query for Binance account balance returned ` + | ||
`non-200 status code ${snapshot.code} with message ${snapshot.msg}.`); | ||
} | ||
const balances = snapshot.snapshotVos | ||
.flatMap((v) => v.data.balances) | ||
const snapshot = await client.accountInfo(); | ||
const balances = snapshot.balances | ||
.filter((v) => Number(v.locked) !== 0 || Number(v.free) !== 0) | ||
.map((b) => ({ | ||
@@ -24,0 +13,0 @@ asset: b.asset, |
@@ -10,3 +10,3 @@ { | ||
"homepage": "https://github.com/lunch-money/binance-to-lunch-money#README", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"license": "MIT", | ||
@@ -13,0 +13,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12744
144