MCPcopy
hub / github.com/quantopian/zipline / lookup_future_symbol

Method lookup_future_symbol

zipline/assets/assets.py:1082–1108  ·  view source on GitHub ↗

Lookup a future contract by symbol. Parameters ---------- symbol : str The symbol of the desired contract. Returns ------- future : Future The future contract referenced by ``symbol``. Raises ------ Sy

(self, symbol)

Source from the content-addressed store, hash-verified

1080 return out
1081
1082 def lookup_future_symbol(self, symbol):
1083 """Lookup a future contract by symbol.
1084
1085 Parameters
1086 ----------
1087 symbol : str
1088 The symbol of the desired contract.
1089
1090 Returns
1091 -------
1092 future : Future
1093 The future contract referenced by ``symbol``.
1094
1095 Raises
1096 ------
1097 SymbolNotFound
1098 Raised when no contract named 'symbol' is found.
1099
1100 """
1101
1102 data = self._select_asset_by_symbol(self.futures_contracts, symbol)\
1103 .execute().fetchone()
1104
1105 # If no data found, raise an exception
1106 if not data:
1107 raise SymbolNotFound(symbol=symbol)
1108 return self.retrieve_asset(data['sid'])
1109
1110 def lookup_by_supplementary_field(self, field_name, value, as_of_date):
1111 try:

Callers 4

future_symbolMethod · 0.80
init_class_fixturesMethod · 0.80

Calls 3

retrieve_assetMethod · 0.95
SymbolNotFoundClass · 0.90

Tested by 2

init_class_fixturesMethod · 0.64