How to use the zvt.reader.business_reader.AccountReader function in zvt

To help you get started, we’ve selected a few zvt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zvtvz / zvt / zvt / test_dash.py View on Github external
# -*- coding: utf-8 -*-

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

from zvt.charts.dcc_components import get_trader_detail_figures
from zvt.domain import TradingLevel
from zvt.reader.business_reader import AccountReader, OrderReader

trader = 'cointrader'

account_reader = AccountReader(trader_names=['cointrader'], level=TradingLevel.LEVEL_1MIN)
order_reader = OrderReader(trader_names=['cointrader'])


def serve_layout():
    layout = html.Div(
        [
            html.Div(id='content'),
            dcc.Interval(
                id='interval-component',
                interval=10 * 1000,  # in milliseconds
                n_intervals=0
            )
        ])

    return layout
github zvtvz / zvt / zvt / apps / trader_app.py View on Github external
def load_traders():
    global trader_domains
    global trader_names

    trader_domains = get_trader(return_type='domain')
    for trader in trader_domains:
        account_readers.append(AccountReader(trader_names=[trader.trader_name], level=trader.level))
        order_readers.append(OrderReader(trader_names=[trader.trader_name]))

    trader_names = [item.trader_name for item in trader_domains]
github zvtvz / zvt / zvt / apps / trader_app.py View on Github external
def load_traders():
    global trader_domains
    global trader_names

    trader_domains = get_trader(return_type='domain')
    for trader in trader_domains:
        account_readers.append(AccountReader(trader_names=[trader.trader_name], level=trader.level))
        order_readers.append(OrderReader(trader_names=[trader.trader_name]))

    trader_names = [item.trader_name for item in trader_domains]
github zvtvz / zvt / zvt / trader / trader.py View on Github external
def on_finish(self):
        # show the result
        import plotly.io as pio
        pio.renderers.default = "browser"
        reader = AccountReader(trader_names=[self.trader_name])
        drawer = Drawer(main_data=NormalData(reader.data_df.copy()[['trader_name', 'timestamp', 'all_value']],
                                             category_field='trader_name'))
        drawer.draw_line()
github zvtvz / zvt / zvt / reader / business_reader.py View on Github external
self.filters = filters

        if self.trader_names:
            filter = [Order.trader_name == name for name in self.trader_names]
            if self.filters:
                self.filters += filter
            else:
                self.filters = filter

        super().__init__(SimAccount, None, None, None, None, None, the_timestamp,
                         start_timestamp, end_timestamp, columns, filters, order, None, 'zvt', level,
                         'trader_name', 'timestamp', None)


if __name__ == '__main__':
    reader = AccountReader(trader_names=['000338_ma_trader'])
    drawer = Drawer(main_data=NormalData(reader.data_df.copy()[['trader_name', 'timestamp', 'all_value']],
                                         category_field='trader_name'))
    drawer.draw_line()
github zvtvz / zvt / zvt / realtime_trading_signals.py View on Github external
import dash_core_components as dcc
import dash_daq as daq
import dash_html_components as html
from dash.dependencies import Input, Output

from zvt.api.business import get_trader
from zvt.api.technical import get_current_price
from zvt.charts.dcc_components import get_trader_detail_figures
from zvt.domain import TradingLevel
from zvt.reader.business_reader import AccountReader, OrderReader

trader = 'singlecointrader'
security = 'coin_binance_EOS/USDT'

trader_domain = get_trader(trader_name=trader, return_type='domain')[0]
account_reader = AccountReader(trader_names=['singlecointrader'], level=TradingLevel.LEVEL_1MIN)
order_reader = OrderReader(trader_names=['singlecointrader'])


def serve_layout():
    layout = html.Div(
        [
            daq.LEDDisplay(
                id='current_price',
                label="EOS/USDT current price",
                value=get_current_price(security_list=[security]),
                color="#FF5E5E"
            ),

            html.Div(id='trader-details', children=get_trader_detail_figures(trader_domain=trader_domain,
                                                                             account_reader=None,
                                                                             order_reader=order_reader)),