'start with $1,000, then buy 1000 shares at $10.
price goes to $11'

def test_levered_long_position(self):

    self.create_environment_stuff()
    trades = factory.create_trade_history(self.asset1, [10, 10, 10, 11], [100, 100, 100, 100], oneday, self.sim_params, trading_calendar=self.trading_calendar)
    data_portal = create_data_portal_from_trade_history(self.env.asset_finder, self.trading_calendar, self.instance_tmpdir, self.sim_params, {1: trades})
    txn = create_txn(self.asset1, trades[1].dt, 10.0, 1000)
    pt = perf.PositionTracker(self.sim_params.data_frequency)
    pp = perf.PerformancePeriod(1000.0, self.sim_params.data_frequency)
    pp.position_tracker = pt
    pt.execute_transaction(txn)
    pp.handle_execution(txn)
    pp.calculate_performance()
    check_perf_period(pp, gross_leverage=10.0, net_leverage=10.0, long_exposure=10000.0, longs_count=1, short_exposure=0.0, shorts_count=0)
    pt.sync_last_sale_prices(trades[(-2)].dt, False, data_portal)
    account = pp.as_account()
    check_account(account, settled_cash=(-9000.0), equity_with_loan=1000.0, total_positions_value=10000.0, total_positions_exposure=10000.0, regt_equity=(-9000.0), available_funds=(-9000.0), excess_liquidity=(-9000.0), cushion=(-9.0), leverage=10.0, net_leverage=10.0, net_liquidation=1000.0)
    pt.sync_last_sale_prices(trades[(-1)].dt, False, data_portal)
    pp.calculate_performance()
    check_perf_period(pp, gross_leverage=5.5, net_leverage=5.5, long_exposure=11000.0, longs_count=1, short_exposure=0.0, shorts_count=0)
    account = pp.as_account()
    check_account(account, settled_cash=(-9000.0), equity_with_loan=2000.0, total_positions_value=11000.0, total_positions_exposure=11000.0, regt_equity=(-9000.0), available_funds=(-9000.0), excess_liquidity=(-9000.0), cushion=(-4.5), leverage=5.5, net_leverage=5.5, net_liquidation=2000.0)
