workbench icon indicating copy to clipboard operation
workbench copied to clipboard

Balance is not showing up when there are missing products

Open ihorkatkov opened this issue 4 years ago • 1 comments

Hey @rupurt.

The dashboard is not showing balance for missing products for default dev config. For my case, the solution is to add etc_usdt to products of binance and okex.

I'm wondering, how to make it user-friendly? I see several options:

  • Display appropriate error in the logs and don't show balance. E.g Missing #{product} in the #{venue} venue. Please add it in order to show the balance.
  • Filter out invalid values and show balance
  • Display the error and show balance

I'd be happy to apply any solution.

WDYT?

Example

iex> config = %Workbench.BalanceSnapshots.Config{
  boot_delay_ms: 10000,
  btc_usd_symbol: :btc_usdt,
  btc_usd_venue: :okex,
  enabled: true,
  every_ms: 10000,
  quote_pairs: [binance: :usdt, okex: :usdt],
  usd_quote_asset: :usdt,
  usd_quote_venue: :okex
}


iex> Tai.Venues.AccountStore.all()
[
  %Tai.Venues.Account{
    asset: :btc,
    credential_id: :main,
    equity: #Decimal<0>,
    free: #Decimal<0>,
    locked: #Decimal<0>,
    type: "futures",
    venue_id: :okex
  },
  %Tai.Venues.Account{
    asset: :btc,
    credential_id: :main,
    equity: #Decimal<0>,
    free: #Decimal<0>,
    locked: #Decimal<0>,
    type: "swap",
    venue_id: :okex
  },
  %Tai.Venues.Account{
    asset: :etc,
    credential_id: :main,
    equity: #Decimal<0>,
    free: #Decimal<0>,
    locked: #Decimal<0>,
    type: "swap",
    venue_id: :okex
  }
]

iex> Workbench.BalanceSnapshots.Snapshot.create(config)
{:error, [{:binance, :etc_usdt, :not_found}, {:okex, :etc_usdt, :not_found}]}

ihorkatkov avatar Jul 01 '20 12:07 ihorkatkov

Nice find.

I'm working on a real time balance streaming feature that hasn't shipped yet, so keeping that in mind. I feel like the best option is to

Display appropriate error in the logs and don't show balance. E.g Missing #{product} in the #{venue} venue. Please add it in order to show the balance.

rupurt avatar Jul 03 '20 01:07 rupurt