Beispiel #1
0
 def account(self):
     account = self._api.get_account()
     z_account = zp.Account()
     z_account.buying_power = float(account.buying_power)
     z_account.total_position_value = float(
         account.portfolio_value) - float(account.cash)
     return z_account
Beispiel #2
0
    def __init__(self, cash=1e6, size=50, clock=None):
        '''
        paramters:
            cash: initial cash balance
            size: the number of stocks in universe
            clock: soft clock
        '''
        self._account = zp.Account()
        self._account.buying_power = cash
        self._account.total_position_value = 0
        self._portfolio = zp.Portfolio()
        self._portfolio.cash = cash
        self._portfolio.positions = self._positions = zp.Positions()
        self._order_seq = 0
        self._orders = {}
        self._clock = clock
        self._last_process_time = None

        self._data_proxy = FakeDataBackend(size=size, clock=clock)