def test_calc_position_value_nan_exec(self):
        quotes = pd.DataFrame(
            {
                'c': [np.nan, 2, 3, 4, 5, 6],
                'exec': [np.nan, 3, 4, 5, 6, np.nan],
            },
            index=[
                pd.Timestamp(d) for d in [
                    '2018-01-01', '2018-01-02', '2018-01-03', '2018-01-07',
                    '2018-01-08', '2018-01-09'
                ]
            ])
        _asset_dict = {
            'ticker': 'test_ticker',
            'quotes': quotes,
            'point_value': 100
        }
        a = Asset(**_asset_dict)

        # Valid case
        self.assertEqual(
            6 * 100 * 100,
            a.calc_position_value(pd.Timestamp('2018-01-09'), 100))
        self.assertEqual(
            6 * 100 * 100,
            a.calc_position_value(pd.Timestamp('2018-01-09'), -100))
        # Both are nan raise
        self.assertRaises(ValueError, a.calc_position_value,
                          pd.Timestamp('2018-01-01'), 100)
    def test_calc_position_value(self):
        _asset_dict = {
            'ticker': 'test_ticker',
            'quotes': self.quotes,
            'point_value': 100
        }
        a = Asset(**_asset_dict)

        # Valid case
        self.assertEqual(
            2 * 100 * 100,
            a.calc_position_value(pd.Timestamp('2018-01-01'), 100))
        self.assertEqual(
            2 * 100 * 100,
            a.calc_position_value(pd.Timestamp('2018-01-01'), -100))