Beispiel #1
0
    def test_fetch_fields(self):
        client = gen_client()
        option_id = "e03e7414-527d-4b44-a081-c61aeb474060"
        with gen_vcr().use_cassette("option_fetch.yaml"):
            option = Option.fetch(client, option_id)

            expected_fields = [
                'issue_date', 'tradability', 'strike_price', 'state', 'url',
                'expiration_date', 'created_at', 'chain_id', 'updated_at',
                'rhs_tradability', 'type', 'chain_symbol', 'min_ticks', 'id']

            actual_fields = list(option.keys())

            assert(set(expected_fields) == set(actual_fields))
Beispiel #2
0
    def test_fetch_fields(self):
        client = gen_client()
        with gen_vcr().use_cassette('dividend_all.yaml'):
            dividends = Dividend.all(client)
            dividend = dividends[0]

            expected_fields = [
                'account', 'url', 'amount', 'payable_date', 'instrument',
                'rate', 'record_date', 'position', 'withholding', 'id',
                'paid_at'
            ]

            actual_fields = list(dividend.keys())

            assert (set(expected_fields) == set(actual_fields))
Beispiel #3
0
    def test_fetch_fields(self):
        client = gen_client()
        with gen_vcr().use_cassette('option_position_all.yaml'):
            option_positions = OptionPosition.all(client)
            option_position = option_positions[0]

            expected_fields = [
                'intraday_average_open_price', 'account', 'intraday_quantity',
                'option', 'created_at', 'updated_at', 'average_price',
                'chain_id', 'pending_expired_quantity', 'pending_buy_quantity',
                'url', 'pending_sell_quantity', 'chain_symbol', 'type', 'id',
                'quantity']

            actual_fields = list(option_position.keys())

            assert(set(expected_fields) == set(actual_fields))
Beispiel #4
0
    def test_fetch_fields(self):
        client = gen_client()

        oc_id = "644f21f0-a166-4c94-bd67-02568d3a5940"
        oc_symbol = "TLT"

        with gen_vcr().use_cassette('option_chain_fetch.yaml'):
            chain = OptionChain.fetch(client, oc_id, oc_symbol)

            expected_fields = [
                'can_open_position', 'symbol', 'trade_value_multiplier',
                'underlying_instruments', 'expiration_dates', 'cash_component',
                'min_ticks', 'id']

            actual_fields = list(chain.keys())

            assert(set(expected_fields) == set(actual_fields))
Beispiel #5
0
    def test_fetch_fields(self):
        client = gen_client()
        symbol = "TLT"
        with gen_vcr().use_cassette('stock_fetch.yaml'):
            stock = Stock.fetch(client, symbol)

            expected_fields = [
                'margin_initial_ratio', 'rhs_tradability', 'id', 'market',
                'simple_name', 'min_tick_size', 'maintenance_ratio',
                'tradability', 'state', 'type', 'tradeable', 'fundamentals',
                'quote', 'symbol', 'day_trade_ratio', 'name',
                'tradable_chain_id', 'splits', 'url', 'country',
                'bloomberg_unique', 'list_date'
            ]

            actual_fields = list(stock.keys())

            assert (set(expected_fields) == set(actual_fields))
Beispiel #6
0
    def test_fetch_fields(self):
        client = gen_client()
        with gen_vcr().use_cassette('position_all.yaml'):
            stock_positions = StockPosition.all(client)
            stock_position = stock_positions[0]

            expected_fields = [
                'shares_held_for_stock_grants', 'account',
                'pending_average_buy_price', 'shares_held_for_options_events',
                'intraday_average_buy_price', 'url',
                'shares_held_for_options_collateral', 'created_at',
                'updated_at', 'shares_held_for_buys', 'average_buy_price',
                'instrument', 'intraday_quantity', 'shares_held_for_sells',
                'shares_pending_from_options_events', 'quantity'
            ]

            actual_fields = list(stock_position.keys())

            assert (set(expected_fields) == set(actual_fields))
Beispiel #7
0
    def test_fetch_fields(self):
        client = gen_client()
        with gen_vcr().use_cassette('stockorder_all.yaml'):
            orders = StockOrder.all(client)
            order = orders[0]

            expected_fields = [
                'updated_at', 'ref_id', 'time_in_force', 'fees', 'cancel',
                'response_category', 'id', 'cumulative_quantity', 'stop_price',
                'reject_reason', 'instrument', 'state', 'trigger',
                'override_dtbp_checks', 'type', 'last_transaction_at', 'price',
                'executions', 'extended_hours', 'account', 'url', 'created_at',
                'side', 'override_day_trade_checks', 'position',
                'average_price', 'quantity'
            ]

            actual_fields = list(order.keys())

            assert (set(expected_fields) == set(actual_fields))
Beispiel #8
0
 def test_fetch(self):
     client = gen_client()
     with gen_vcr().use_cassette('user_fetch.yaml'):
         data = User.fetch(client)
         assert (data['username'] == 'my_username')