partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | impute | Columnwise replaces all ``NaNs`` and ``infs`` from the DataFrame `df_impute` with average/extreme values from
the same columns. This is done as follows: Each occurring ``inf`` or ``NaN`` in `df_impute` is replaced by
* ``-inf`` -> ``min``
* ``+inf`` -> ``max``
* ``NaN`` -> ``median``
I... | tsfresh/utilities/dataframe_functions.py | def impute(df_impute):
"""
Columnwise replaces all ``NaNs`` and ``infs`` from the DataFrame `df_impute` with average/extreme values from
the same columns. This is done as follows: Each occurring ``inf`` or ``NaN`` in `df_impute` is replaced by
* ``-inf`` -> ``min``
* ``+inf`` -> ``max``
... | def impute(df_impute):
"""
Columnwise replaces all ``NaNs`` and ``infs`` from the DataFrame `df_impute` with average/extreme values from
the same columns. This is done as follows: Each occurring ``inf`` or ``NaN`` in `df_impute` is replaced by
* ``-inf`` -> ``min``
* ``+inf`` -> ``max``
... | [
"Columnwise",
"replaces",
"all",
"NaNs",
"and",
"infs",
"from",
"the",
"DataFrame",
"df_impute",
"with",
"average",
"/",
"extreme",
"values",
"from",
"the",
"same",
"columns",
".",
"This",
"is",
"done",
"as",
"follows",
":",
"Each",
"occurring",
"inf",
"or",... | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L41-L66 | [
"def",
"impute",
"(",
"df_impute",
")",
":",
"col_to_max",
",",
"col_to_min",
",",
"col_to_median",
"=",
"get_range_values_per_column",
"(",
"df_impute",
")",
"df_impute",
"=",
"impute_dataframe_range",
"(",
"df_impute",
",",
"col_to_max",
",",
"col_to_min",
",",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | impute_dataframe_zero | Replaces all ``NaNs``, ``-infs`` and ``+infs`` from the DataFrame `df_impute` with 0s.
The `df_impute` will be modified in place. All its columns will be into converted into dtype ``np.float64``.
:param df_impute: DataFrame to impute
:type df_impute: pandas.DataFrame
:return df_impute: imputed DataFra... | tsfresh/utilities/dataframe_functions.py | def impute_dataframe_zero(df_impute):
"""
Replaces all ``NaNs``, ``-infs`` and ``+infs`` from the DataFrame `df_impute` with 0s.
The `df_impute` will be modified in place. All its columns will be into converted into dtype ``np.float64``.
:param df_impute: DataFrame to impute
:type df_impute: pandas... | def impute_dataframe_zero(df_impute):
"""
Replaces all ``NaNs``, ``-infs`` and ``+infs`` from the DataFrame `df_impute` with 0s.
The `df_impute` will be modified in place. All its columns will be into converted into dtype ``np.float64``.
:param df_impute: DataFrame to impute
:type df_impute: pandas... | [
"Replaces",
"all",
"NaNs",
"-",
"infs",
"and",
"+",
"infs",
"from",
"the",
"DataFrame",
"df_impute",
"with",
"0s",
".",
"The",
"df_impute",
"will",
"be",
"modified",
"in",
"place",
".",
"All",
"its",
"columns",
"will",
"be",
"into",
"converted",
"into",
... | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L69-L86 | [
"def",
"impute_dataframe_zero",
"(",
"df_impute",
")",
":",
"df_impute",
".",
"replace",
"(",
"[",
"np",
".",
"PINF",
",",
"np",
".",
"NINF",
"]",
",",
"0",
",",
"inplace",
"=",
"True",
")",
"df_impute",
".",
"fillna",
"(",
"0",
",",
"inplace",
"=",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | impute_dataframe_range | Columnwise replaces all ``NaNs``, ``-inf`` and ``+inf`` from the DataFrame `df_impute` with average/extreme values
from the provided dictionaries.
This is done as follows: Each occurring ``inf`` or ``NaN`` in `df_impute` is replaced by
* ``-inf`` -> by value in col_to_min
* ``+inf`` -> by valu... | tsfresh/utilities/dataframe_functions.py | def impute_dataframe_range(df_impute, col_to_max, col_to_min, col_to_median):
"""
Columnwise replaces all ``NaNs``, ``-inf`` and ``+inf`` from the DataFrame `df_impute` with average/extreme values
from the provided dictionaries.
This is done as follows: Each occurring ``inf`` or ``NaN`` in `df_impute` ... | def impute_dataframe_range(df_impute, col_to_max, col_to_min, col_to_median):
"""
Columnwise replaces all ``NaNs``, ``-inf`` and ``+inf`` from the DataFrame `df_impute` with average/extreme values
from the provided dictionaries.
This is done as follows: Each occurring ``inf`` or ``NaN`` in `df_impute` ... | [
"Columnwise",
"replaces",
"all",
"NaNs",
"-",
"inf",
"and",
"+",
"inf",
"from",
"the",
"DataFrame",
"df_impute",
"with",
"average",
"/",
"extreme",
"values",
"from",
"the",
"provided",
"dictionaries",
"."
] | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L89-L147 | [
"def",
"impute_dataframe_range",
"(",
"df_impute",
",",
"col_to_max",
",",
"col_to_min",
",",
"col_to_median",
")",
":",
"columns",
"=",
"df_impute",
".",
"columns",
"# Making sure col_to_median, col_to_max and col_to_min have entries for every column",
"if",
"not",
"set",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | get_range_values_per_column | Retrieves the finite max, min and mean values per column in the DataFrame `df` and stores them in three
dictionaries. Those dictionaries `col_to_max`, `col_to_min`, `col_to_median` map the columnname to the maximal,
minimal or median value of that column.
If a column does not contain any finite values at a... | tsfresh/utilities/dataframe_functions.py | def get_range_values_per_column(df):
"""
Retrieves the finite max, min and mean values per column in the DataFrame `df` and stores them in three
dictionaries. Those dictionaries `col_to_max`, `col_to_min`, `col_to_median` map the columnname to the maximal,
minimal or median value of that column.
If... | def get_range_values_per_column(df):
"""
Retrieves the finite max, min and mean values per column in the DataFrame `df` and stores them in three
dictionaries. Those dictionaries `col_to_max`, `col_to_min`, `col_to_median` map the columnname to the maximal,
minimal or median value of that column.
If... | [
"Retrieves",
"the",
"finite",
"max",
"min",
"and",
"mean",
"values",
"per",
"column",
"in",
"the",
"DataFrame",
"df",
"and",
"stores",
"them",
"in",
"three",
"dictionaries",
".",
"Those",
"dictionaries",
"col_to_max",
"col_to_min",
"col_to_median",
"map",
"the",... | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L150-L183 | [
"def",
"get_range_values_per_column",
"(",
"df",
")",
":",
"data",
"=",
"df",
".",
"get_values",
"(",
")",
"masked",
"=",
"np",
".",
"ma",
".",
"masked_invalid",
"(",
"data",
")",
"columns",
"=",
"df",
".",
"columns",
"is_col_non_finite",
"=",
"masked",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | restrict_input_to_index | Restrict df_or_dict to those ids contained in index.
:param df_or_dict: a pandas DataFrame or a dictionary.
:type df_or_dict: pandas.DataFrame or dict
:param column_id: it must be present in the pandas DataFrame or in all DataFrames in the dictionary.
It is not allowed to have NaN values in this co... | tsfresh/utilities/dataframe_functions.py | def restrict_input_to_index(df_or_dict, column_id, index):
"""
Restrict df_or_dict to those ids contained in index.
:param df_or_dict: a pandas DataFrame or a dictionary.
:type df_or_dict: pandas.DataFrame or dict
:param column_id: it must be present in the pandas DataFrame or in all DataFrames in ... | def restrict_input_to_index(df_or_dict, column_id, index):
"""
Restrict df_or_dict to those ids contained in index.
:param df_or_dict: a pandas DataFrame or a dictionary.
:type df_or_dict: pandas.DataFrame or dict
:param column_id: it must be present in the pandas DataFrame or in all DataFrames in ... | [
"Restrict",
"df_or_dict",
"to",
"those",
"ids",
"contained",
"in",
"index",
"."
] | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L186-L210 | [
"def",
"restrict_input_to_index",
"(",
"df_or_dict",
",",
"column_id",
",",
"index",
")",
":",
"if",
"isinstance",
"(",
"df_or_dict",
",",
"pd",
".",
"DataFrame",
")",
":",
"df_or_dict_restricted",
"=",
"df_or_dict",
"[",
"df_or_dict",
"[",
"column_id",
"]",
"... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | get_ids | Aggregates all ids in column_id from the time series container `
:param df_or_dict: a pandas DataFrame or a dictionary.
:type df_or_dict: pandas.DataFrame or dict
:param column_id: it must be present in the pandas DataFrame or in all DataFrames in the dictionary.
It is not allowed to have NaN value... | tsfresh/utilities/dataframe_functions.py | def get_ids(df_or_dict, column_id):
"""
Aggregates all ids in column_id from the time series container `
:param df_or_dict: a pandas DataFrame or a dictionary.
:type df_or_dict: pandas.DataFrame or dict
:param column_id: it must be present in the pandas DataFrame or in all DataFrames in the diction... | def get_ids(df_or_dict, column_id):
"""
Aggregates all ids in column_id from the time series container `
:param df_or_dict: a pandas DataFrame or a dictionary.
:type df_or_dict: pandas.DataFrame or dict
:param column_id: it must be present in the pandas DataFrame or in all DataFrames in the diction... | [
"Aggregates",
"all",
"ids",
"in",
"column_id",
"from",
"the",
"time",
"series",
"container"
] | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L213-L232 | [
"def",
"get_ids",
"(",
"df_or_dict",
",",
"column_id",
")",
":",
"if",
"isinstance",
"(",
"df_or_dict",
",",
"pd",
".",
"DataFrame",
")",
":",
"return",
"set",
"(",
"df_or_dict",
"[",
"column_id",
"]",
")",
"elif",
"isinstance",
"(",
"df_or_dict",
",",
"... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | _normalize_input_to_internal_representation | Try to transform any given input to the internal representation of time series, which is a flat DataFrame
(the first format from see :ref:`data-formats-label`).
This function can transform pandas DataFrames in different formats or dictionaries into the internal format
that we use. It should not be called b... | tsfresh/utilities/dataframe_functions.py | def _normalize_input_to_internal_representation(timeseries_container, column_id, column_sort, column_kind, column_value):
"""
Try to transform any given input to the internal representation of time series, which is a flat DataFrame
(the first format from see :ref:`data-formats-label`).
This function ca... | def _normalize_input_to_internal_representation(timeseries_container, column_id, column_sort, column_kind, column_value):
"""
Try to transform any given input to the internal representation of time series, which is a flat DataFrame
(the first format from see :ref:`data-formats-label`).
This function ca... | [
"Try",
"to",
"transform",
"any",
"given",
"input",
"to",
"the",
"internal",
"representation",
"of",
"time",
"series",
"which",
"is",
"a",
"flat",
"DataFrame",
"(",
"the",
"first",
"format",
"from",
"see",
":",
"ref",
":",
"data",
"-",
"formats",
"-",
"la... | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L237-L351 | [
"def",
"_normalize_input_to_internal_representation",
"(",
"timeseries_container",
",",
"column_id",
",",
"column_sort",
",",
"column_kind",
",",
"column_value",
")",
":",
"# Also make it possible to have a dict as an input",
"if",
"isinstance",
"(",
"timeseries_container",
","... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | roll_time_series | This method creates sub windows of the time series. It rolls the (sorted) data frames for each kind and each id
separately in the "time" domain (which is represented by the sort order of the sort column given by `column_sort`).
For each rolling step, a new id is created by the scheme "id={id}, shift={shift}", ... | tsfresh/utilities/dataframe_functions.py | def roll_time_series(df_or_dict, column_id, column_sort, column_kind, rolling_direction, max_timeshift=None):
"""
This method creates sub windows of the time series. It rolls the (sorted) data frames for each kind and each id
separately in the "time" domain (which is represented by the sort order of the sor... | def roll_time_series(df_or_dict, column_id, column_sort, column_kind, rolling_direction, max_timeshift=None):
"""
This method creates sub windows of the time series. It rolls the (sorted) data frames for each kind and each id
separately in the "time" domain (which is represented by the sort order of the sor... | [
"This",
"method",
"creates",
"sub",
"windows",
"of",
"the",
"time",
"series",
".",
"It",
"rolls",
"the",
"(",
"sorted",
")",
"data",
"frames",
"for",
"each",
"kind",
"and",
"each",
"id",
"separately",
"in",
"the",
"time",
"domain",
"(",
"which",
"is",
... | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L354-L471 | [
"def",
"roll_time_series",
"(",
"df_or_dict",
",",
"column_id",
",",
"column_sort",
",",
"column_kind",
",",
"rolling_direction",
",",
"max_timeshift",
"=",
"None",
")",
":",
"if",
"rolling_direction",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Rolling directi... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | make_forecasting_frame | Takes a singular time series x and constructs a DataFrame df and target vector y that can be used for a time series
forecasting task.
The returned df will contain, for every time stamp in x, the last max_timeshift data points as a new
time series, such can be used to fit a time series forecasting model.
... | tsfresh/utilities/dataframe_functions.py | def make_forecasting_frame(x, kind, max_timeshift, rolling_direction):
"""
Takes a singular time series x and constructs a DataFrame df and target vector y that can be used for a time series
forecasting task.
The returned df will contain, for every time stamp in x, the last max_timeshift data points as... | def make_forecasting_frame(x, kind, max_timeshift, rolling_direction):
"""
Takes a singular time series x and constructs a DataFrame df and target vector y that can be used for a time series
forecasting task.
The returned df will contain, for every time stamp in x, the last max_timeshift data points as... | [
"Takes",
"a",
"singular",
"time",
"series",
"x",
"and",
"constructs",
"a",
"DataFrame",
"df",
"and",
"target",
"vector",
"y",
"that",
"can",
"be",
"used",
"for",
"a",
"time",
"series",
"forecasting",
"task",
"."
] | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/utilities/dataframe_functions.py#L474-L533 | [
"def",
"make_forecasting_frame",
"(",
"x",
",",
"kind",
",",
"max_timeshift",
",",
"rolling_direction",
")",
":",
"n",
"=",
"len",
"(",
"x",
")",
"if",
"isinstance",
"(",
"x",
",",
"pd",
".",
"Series",
")",
":",
"t",
"=",
"x",
".",
"index",
"else",
... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | select_features | Check the significance of all features (columns) of feature matrix X and return a possibly reduced feature matrix
only containing relevant features.
The feature matrix must be a pandas.DataFrame in the format:
+-------+-----------+-----------+-----+-----------+
| index | feature_1 | feature_2 ... | tsfresh/feature_selection/selection.py | def select_features(X, y, test_for_binary_target_binary_feature=defaults.TEST_FOR_BINARY_TARGET_BINARY_FEATURE,
test_for_binary_target_real_feature=defaults.TEST_FOR_BINARY_TARGET_REAL_FEATURE,
test_for_real_target_binary_feature=defaults.TEST_FOR_REAL_TARGET_BINARY_FEATURE,
... | def select_features(X, y, test_for_binary_target_binary_feature=defaults.TEST_FOR_BINARY_TARGET_BINARY_FEATURE,
test_for_binary_target_real_feature=defaults.TEST_FOR_BINARY_TARGET_REAL_FEATURE,
test_for_real_target_binary_feature=defaults.TEST_FOR_REAL_TARGET_BINARY_FEATURE,
... | [
"Check",
"the",
"significance",
"of",
"all",
"features",
"(",
"columns",
")",
"of",
"feature",
"matrix",
"X",
"and",
"return",
"a",
"possibly",
"reduced",
"feature",
"matrix",
"only",
"containing",
"relevant",
"features",
"."
] | blue-yonder/tsfresh | python | https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_selection/selection.py#L22-L153 | [
"def",
"select_features",
"(",
"X",
",",
"y",
",",
"test_for_binary_target_binary_feature",
"=",
"defaults",
".",
"TEST_FOR_BINARY_TARGET_BINARY_FEATURE",
",",
"test_for_binary_target_real_feature",
"=",
"defaults",
".",
"TEST_FOR_BINARY_TARGET_REAL_FEATURE",
",",
"test_for_rea... | c72c9c574371cf7dd7d54e00a466792792e5d202 |
train | IB.connect | Connect to a running TWS or IB gateway application.
After the connection is made the client is fully synchronized
and ready to serve requests.
This method is blocking.
Args:
host: Host name or IP address.
port: Port number.
clientId: ID number to use... | ib_insync/ib.py | def connect(
self, host: str = '127.0.0.1', port: int = 7497,
clientId: int = 1, timeout: float = 2):
"""
Connect to a running TWS or IB gateway application.
After the connection is made the client is fully synchronized
and ready to serve requests.
This m... | def connect(
self, host: str = '127.0.0.1', port: int = 7497,
clientId: int = 1, timeout: float = 2):
"""
Connect to a running TWS or IB gateway application.
After the connection is made the client is fully synchronized
and ready to serve requests.
This m... | [
"Connect",
"to",
"a",
"running",
"TWS",
"or",
"IB",
"gateway",
"application",
".",
"After",
"the",
"connection",
"is",
"made",
"the",
"client",
"is",
"fully",
"synchronized",
"and",
"ready",
"to",
"serve",
"requests",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L208-L228 | [
"def",
"connect",
"(",
"self",
",",
"host",
":",
"str",
"=",
"'127.0.0.1'",
",",
"port",
":",
"int",
"=",
"7497",
",",
"clientId",
":",
"int",
"=",
"1",
",",
"timeout",
":",
"float",
"=",
"2",
")",
":",
"return",
"self",
".",
"_run",
"(",
"self",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.disconnect | Disconnect from a TWS or IB gateway application.
This will clear all session state. | ib_insync/ib.py | def disconnect(self):
"""
Disconnect from a TWS or IB gateway application.
This will clear all session state.
"""
if not self.client.isConnected():
return
stats = self.client.connectionStats()
self._logger.info(
f'Disconnecting from {self.c... | def disconnect(self):
"""
Disconnect from a TWS or IB gateway application.
This will clear all session state.
"""
if not self.client.isConnected():
return
stats = self.client.connectionStats()
self._logger.info(
f'Disconnecting from {self.c... | [
"Disconnect",
"from",
"a",
"TWS",
"or",
"IB",
"gateway",
"application",
".",
"This",
"will",
"clear",
"all",
"session",
"state",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L230-L245 | [
"def",
"disconnect",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"client",
".",
"isConnected",
"(",
")",
":",
"return",
"stats",
"=",
"self",
".",
"client",
".",
"connectionStats",
"(",
")",
"self",
".",
"_logger",
".",
"info",
"(",
"f'Disconnecti... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.waitOnUpdate | Wait on any new update to arrive from the network.
Args:
timeout: Maximum time in seconds to wait.
If 0 then no timeout is used.
.. note::
A loop with ``waitOnUpdate`` should not be used to harvest
tick data from tickers, since some ticks can go miss... | ib_insync/ib.py | def waitOnUpdate(self, timeout: float = 0) -> bool:
"""
Wait on any new update to arrive from the network.
Args:
timeout: Maximum time in seconds to wait.
If 0 then no timeout is used.
.. note::
A loop with ``waitOnUpdate`` should not be used to ... | def waitOnUpdate(self, timeout: float = 0) -> bool:
"""
Wait on any new update to arrive from the network.
Args:
timeout: Maximum time in seconds to wait.
If 0 then no timeout is used.
.. note::
A loop with ``waitOnUpdate`` should not be used to ... | [
"Wait",
"on",
"any",
"new",
"update",
"to",
"arrive",
"from",
"the",
"network",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L263-L283 | [
"def",
"waitOnUpdate",
"(",
"self",
",",
"timeout",
":",
"float",
"=",
"0",
")",
"->",
"bool",
":",
"if",
"timeout",
":",
"with",
"suppress",
"(",
"asyncio",
".",
"TimeoutError",
")",
":",
"util",
".",
"run",
"(",
"asyncio",
".",
"wait_for",
"(",
"se... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.loopUntil | Iterate until condition is met, with optional timeout in seconds.
The yielded value is that of the condition or False when timed out.
Args:
condition: Predicate function that is tested after every network
update.
timeout: Maximum time in seconds to wait.
... | ib_insync/ib.py | def loopUntil(
self, condition=None, timeout: float = 0) -> Iterator[object]:
"""
Iterate until condition is met, with optional timeout in seconds.
The yielded value is that of the condition or False when timed out.
Args:
condition: Predicate function that is tes... | def loopUntil(
self, condition=None, timeout: float = 0) -> Iterator[object]:
"""
Iterate until condition is met, with optional timeout in seconds.
The yielded value is that of the condition or False when timed out.
Args:
condition: Predicate function that is tes... | [
"Iterate",
"until",
"condition",
"is",
"met",
"with",
"optional",
"timeout",
"in",
"seconds",
".",
"The",
"yielded",
"value",
"is",
"that",
"of",
"the",
"condition",
"or",
"False",
"when",
"timed",
"out",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L285-L308 | [
"def",
"loopUntil",
"(",
"self",
",",
"condition",
"=",
"None",
",",
"timeout",
":",
"float",
"=",
"0",
")",
"->",
"Iterator",
"[",
"object",
"]",
":",
"endTime",
"=",
"time",
".",
"time",
"(",
")",
"+",
"timeout",
"while",
"True",
":",
"test",
"="... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.accountValues | List of account values for the given account,
or of all accounts if account is left blank.
Args:
account: If specified, filter for this account name. | ib_insync/ib.py | def accountValues(self, account: str = '') -> List[AccountValue]:
"""
List of account values for the given account,
or of all accounts if account is left blank.
Args:
account: If specified, filter for this account name.
"""
if account:
return [v f... | def accountValues(self, account: str = '') -> List[AccountValue]:
"""
List of account values for the given account,
or of all accounts if account is left blank.
Args:
account: If specified, filter for this account name.
"""
if account:
return [v f... | [
"List",
"of",
"account",
"values",
"for",
"the",
"given",
"account",
"or",
"of",
"all",
"accounts",
"if",
"account",
"is",
"left",
"blank",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L329-L341 | [
"def",
"accountValues",
"(",
"self",
",",
"account",
":",
"str",
"=",
"''",
")",
"->",
"List",
"[",
"AccountValue",
"]",
":",
"if",
"account",
":",
"return",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"wrapper",
".",
"accountValues",
".",
"values",
"("... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.accountSummary | List of account values for the given account,
or of all accounts if account is left blank.
This method is blocking on first run, non-blocking after that.
Args:
account: If specified, filter for this account name. | ib_insync/ib.py | def accountSummary(self, account: str = '') -> List[AccountValue]:
"""
List of account values for the given account,
or of all accounts if account is left blank.
This method is blocking on first run, non-blocking after that.
Args:
account: If specified, filter for t... | def accountSummary(self, account: str = '') -> List[AccountValue]:
"""
List of account values for the given account,
or of all accounts if account is left blank.
This method is blocking on first run, non-blocking after that.
Args:
account: If specified, filter for t... | [
"List",
"of",
"account",
"values",
"for",
"the",
"given",
"account",
"or",
"of",
"all",
"accounts",
"if",
"account",
"is",
"left",
"blank",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L343-L360 | [
"def",
"accountSummary",
"(",
"self",
",",
"account",
":",
"str",
"=",
"''",
")",
"->",
"List",
"[",
"AccountValue",
"]",
":",
"if",
"not",
"self",
".",
"wrapper",
".",
"acctSummary",
":",
"# loaded on demand since it takes ca. 250 ms",
"self",
".",
"reqAccoun... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.portfolio | List of portfolio items of the default account. | ib_insync/ib.py | def portfolio(self) -> List[PortfolioItem]:
"""
List of portfolio items of the default account.
"""
account = self.wrapper.accounts[0]
return [v for v in self.wrapper.portfolio[account].values()] | def portfolio(self) -> List[PortfolioItem]:
"""
List of portfolio items of the default account.
"""
account = self.wrapper.accounts[0]
return [v for v in self.wrapper.portfolio[account].values()] | [
"List",
"of",
"portfolio",
"items",
"of",
"the",
"default",
"account",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L362-L367 | [
"def",
"portfolio",
"(",
"self",
")",
"->",
"List",
"[",
"PortfolioItem",
"]",
":",
"account",
"=",
"self",
".",
"wrapper",
".",
"accounts",
"[",
"0",
"]",
"return",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"wrapper",
".",
"portfolio",
"[",
"account"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.positions | List of positions for the given account,
or of all accounts if account is left blank.
Args:
account: If specified, filter for this account name. | ib_insync/ib.py | def positions(self, account: str = '') -> List[Position]:
"""
List of positions for the given account,
or of all accounts if account is left blank.
Args:
account: If specified, filter for this account name.
"""
if account:
return list(self.wrapper... | def positions(self, account: str = '') -> List[Position]:
"""
List of positions for the given account,
or of all accounts if account is left blank.
Args:
account: If specified, filter for this account name.
"""
if account:
return list(self.wrapper... | [
"List",
"of",
"positions",
"for",
"the",
"given",
"account",
"or",
"of",
"all",
"accounts",
"if",
"account",
"is",
"left",
"blank",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L369-L381 | [
"def",
"positions",
"(",
"self",
",",
"account",
":",
"str",
"=",
"''",
")",
"->",
"List",
"[",
"Position",
"]",
":",
"if",
"account",
":",
"return",
"list",
"(",
"self",
".",
"wrapper",
".",
"positions",
"[",
"account",
"]",
".",
"values",
"(",
")... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.pnl | List of subscribed :class:`.PnL` objects (profit and loss),
optionally filtered by account and/or modelCode.
The :class:`.PnL` objects are kept live updated.
Args:
account: If specified, filter for this account name.
modelCode: If specified, filter for this account mode... | ib_insync/ib.py | def pnl(self, account='', modelCode='') -> List[PnL]:
"""
List of subscribed :class:`.PnL` objects (profit and loss),
optionally filtered by account and/or modelCode.
The :class:`.PnL` objects are kept live updated.
Args:
account: If specified, filter for this accou... | def pnl(self, account='', modelCode='') -> List[PnL]:
"""
List of subscribed :class:`.PnL` objects (profit and loss),
optionally filtered by account and/or modelCode.
The :class:`.PnL` objects are kept live updated.
Args:
account: If specified, filter for this accou... | [
"List",
"of",
"subscribed",
":",
"class",
":",
".",
"PnL",
"objects",
"(",
"profit",
"and",
"loss",
")",
"optionally",
"filtered",
"by",
"account",
"and",
"/",
"or",
"modelCode",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L383-L396 | [
"def",
"pnl",
"(",
"self",
",",
"account",
"=",
"''",
",",
"modelCode",
"=",
"''",
")",
"->",
"List",
"[",
"PnL",
"]",
":",
"return",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"wrapper",
".",
"pnls",
".",
"values",
"(",
")",
"if",
"(",
"not",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.pnlSingle | List of subscribed :class:`.PnLSingle` objects (profit and loss for
single positions).
The :class:`.PnLSingle` objects are kept live updated.
Args:
account: If specified, filter for this account name.
modelCode: If specified, filter for this account model.
c... | ib_insync/ib.py | def pnlSingle(
self, account: str = '', modelCode: str = '',
conId: int = 0) -> List[PnLSingle]:
"""
List of subscribed :class:`.PnLSingle` objects (profit and loss for
single positions).
The :class:`.PnLSingle` objects are kept live updated.
Args:
... | def pnlSingle(
self, account: str = '', modelCode: str = '',
conId: int = 0) -> List[PnLSingle]:
"""
List of subscribed :class:`.PnLSingle` objects (profit and loss for
single positions).
The :class:`.PnLSingle` objects are kept live updated.
Args:
... | [
"List",
"of",
"subscribed",
":",
"class",
":",
".",
"PnLSingle",
"objects",
"(",
"profit",
"and",
"loss",
"for",
"single",
"positions",
")",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L398-L415 | [
"def",
"pnlSingle",
"(",
"self",
",",
"account",
":",
"str",
"=",
"''",
",",
"modelCode",
":",
"str",
"=",
"''",
",",
"conId",
":",
"int",
"=",
"0",
")",
"->",
"List",
"[",
"PnLSingle",
"]",
":",
"return",
"[",
"v",
"for",
"v",
"in",
"self",
".... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.openTrades | List of all open order trades. | ib_insync/ib.py | def openTrades(self) -> List[Trade]:
"""
List of all open order trades.
"""
return [v for v in self.wrapper.trades.values()
if v.orderStatus.status not in OrderStatus.DoneStates] | def openTrades(self) -> List[Trade]:
"""
List of all open order trades.
"""
return [v for v in self.wrapper.trades.values()
if v.orderStatus.status not in OrderStatus.DoneStates] | [
"List",
"of",
"all",
"open",
"order",
"trades",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L423-L428 | [
"def",
"openTrades",
"(",
"self",
")",
"->",
"List",
"[",
"Trade",
"]",
":",
"return",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"wrapper",
".",
"trades",
".",
"values",
"(",
")",
"if",
"v",
".",
"orderStatus",
".",
"status",
"not",
"in",
"OrderStat... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.orders | List of all orders from this session. | ib_insync/ib.py | def orders(self) -> List[Order]:
"""
List of all orders from this session.
"""
return list(
trade.order for trade in self.wrapper.trades.values()) | def orders(self) -> List[Order]:
"""
List of all orders from this session.
"""
return list(
trade.order for trade in self.wrapper.trades.values()) | [
"List",
"of",
"all",
"orders",
"from",
"this",
"session",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L430-L435 | [
"def",
"orders",
"(",
"self",
")",
"->",
"List",
"[",
"Order",
"]",
":",
"return",
"list",
"(",
"trade",
".",
"order",
"for",
"trade",
"in",
"self",
".",
"wrapper",
".",
"trades",
".",
"values",
"(",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.openOrders | List of all open orders. | ib_insync/ib.py | def openOrders(self) -> List[Order]:
"""
List of all open orders.
"""
return [trade.order for trade in self.wrapper.trades.values()
if trade.orderStatus.status not in OrderStatus.DoneStates] | def openOrders(self) -> List[Order]:
"""
List of all open orders.
"""
return [trade.order for trade in self.wrapper.trades.values()
if trade.orderStatus.status not in OrderStatus.DoneStates] | [
"List",
"of",
"all",
"open",
"orders",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L437-L442 | [
"def",
"openOrders",
"(",
"self",
")",
"->",
"List",
"[",
"Order",
"]",
":",
"return",
"[",
"trade",
".",
"order",
"for",
"trade",
"in",
"self",
".",
"wrapper",
".",
"trades",
".",
"values",
"(",
")",
"if",
"trade",
".",
"orderStatus",
".",
"status",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.executions | List of all executions from this session. | ib_insync/ib.py | def executions(self) -> List[Execution]:
"""
List of all executions from this session.
"""
return list(fill.execution for fill in self.wrapper.fills.values()) | def executions(self) -> List[Execution]:
"""
List of all executions from this session.
"""
return list(fill.execution for fill in self.wrapper.fills.values()) | [
"List",
"of",
"all",
"executions",
"from",
"this",
"session",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L450-L454 | [
"def",
"executions",
"(",
"self",
")",
"->",
"List",
"[",
"Execution",
"]",
":",
"return",
"list",
"(",
"fill",
".",
"execution",
"for",
"fill",
"in",
"self",
".",
"wrapper",
".",
"fills",
".",
"values",
"(",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.ticker | Get ticker of the given contract. It must have been requested before
with reqMktData with the same contract object. The ticker may not be
ready yet if called directly after :meth:`.reqMktData`.
Args:
contract: Contract to get ticker for. | ib_insync/ib.py | def ticker(self, contract: Contract) -> Ticker:
"""
Get ticker of the given contract. It must have been requested before
with reqMktData with the same contract object. The ticker may not be
ready yet if called directly after :meth:`.reqMktData`.
Args:
contract: Contr... | def ticker(self, contract: Contract) -> Ticker:
"""
Get ticker of the given contract. It must have been requested before
with reqMktData with the same contract object. The ticker may not be
ready yet if called directly after :meth:`.reqMktData`.
Args:
contract: Contr... | [
"Get",
"ticker",
"of",
"the",
"given",
"contract",
".",
"It",
"must",
"have",
"been",
"requested",
"before",
"with",
"reqMktData",
"with",
"the",
"same",
"contract",
"object",
".",
"The",
"ticker",
"may",
"not",
"be",
"ready",
"yet",
"if",
"called",
"direc... | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L456-L465 | [
"def",
"ticker",
"(",
"self",
",",
"contract",
":",
"Contract",
")",
"->",
"Ticker",
":",
"return",
"self",
".",
"wrapper",
".",
"tickers",
".",
"get",
"(",
"id",
"(",
"contract",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqTickers | Request and return a list of snapshot tickers.
The list is returned when all tickers are ready.
This method is blocking.
Args:
contracts: Contracts to get tickers for.
regulatorySnapshot: Request NBBO snapshots (may incur a fee). | ib_insync/ib.py | def reqTickers(
self, *contracts: List[Contract],
regulatorySnapshot: bool = False) -> List[Ticker]:
"""
Request and return a list of snapshot tickers.
The list is returned when all tickers are ready.
This method is blocking.
Args:
contracts:... | def reqTickers(
self, *contracts: List[Contract],
regulatorySnapshot: bool = False) -> List[Ticker]:
"""
Request and return a list of snapshot tickers.
The list is returned when all tickers are ready.
This method is blocking.
Args:
contracts:... | [
"Request",
"and",
"return",
"a",
"list",
"of",
"snapshot",
"tickers",
".",
"The",
"list",
"is",
"returned",
"when",
"all",
"tickers",
"are",
"ready",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L499-L514 | [
"def",
"reqTickers",
"(",
"self",
",",
"*",
"contracts",
":",
"List",
"[",
"Contract",
"]",
",",
"regulatorySnapshot",
":",
"bool",
"=",
"False",
")",
"->",
"List",
"[",
"Ticker",
"]",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"reqTickersAs... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.qualifyContracts | Fully qualify the given contracts in-place. This will fill in
the missing fields in the contract, especially the conId.
Returns a list of contracts that have been successfully qualified.
This method is blocking.
Args:
contracts: Contracts to qualify. | ib_insync/ib.py | def qualifyContracts(self, *contracts: List[Contract]) -> List[Contract]:
"""
Fully qualify the given contracts in-place. This will fill in
the missing fields in the contract, especially the conId.
Returns a list of contracts that have been successfully qualified.
This method i... | def qualifyContracts(self, *contracts: List[Contract]) -> List[Contract]:
"""
Fully qualify the given contracts in-place. This will fill in
the missing fields in the contract, especially the conId.
Returns a list of contracts that have been successfully qualified.
This method i... | [
"Fully",
"qualify",
"the",
"given",
"contracts",
"in",
"-",
"place",
".",
"This",
"will",
"fill",
"in",
"the",
"missing",
"fields",
"in",
"the",
"contract",
"especially",
"the",
"conId",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L516-L528 | [
"def",
"qualifyContracts",
"(",
"self",
",",
"*",
"contracts",
":",
"List",
"[",
"Contract",
"]",
")",
"->",
"List",
"[",
"Contract",
"]",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"qualifyContractsAsync",
"(",
"*",
"contracts",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.bracketOrder | Create a limit order that is bracketed by a take-profit order and
a stop-loss order. Submit the bracket like:
.. code-block:: python
for o in bracket:
ib.placeOrder(contract, o)
https://interactivebrokers.github.io/tws-api/bracket_order.html
Args:
... | ib_insync/ib.py | def bracketOrder(
self, action: str, quantity: float,
limitPrice: float, takeProfitPrice: float,
stopLossPrice: float, **kwargs) -> BracketOrder:
"""
Create a limit order that is bracketed by a take-profit order and
a stop-loss order. Submit the bracket like:
... | def bracketOrder(
self, action: str, quantity: float,
limitPrice: float, takeProfitPrice: float,
stopLossPrice: float, **kwargs) -> BracketOrder:
"""
Create a limit order that is bracketed by a take-profit order and
a stop-loss order. Submit the bracket like:
... | [
"Create",
"a",
"limit",
"order",
"that",
"is",
"bracketed",
"by",
"a",
"take",
"-",
"profit",
"order",
"and",
"a",
"stop",
"-",
"loss",
"order",
".",
"Submit",
"the",
"bracket",
"like",
":"
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L530-L571 | [
"def",
"bracketOrder",
"(",
"self",
",",
"action",
":",
"str",
",",
"quantity",
":",
"float",
",",
"limitPrice",
":",
"float",
",",
"takeProfitPrice",
":",
"float",
",",
"stopLossPrice",
":",
"float",
",",
"*",
"*",
"kwargs",
")",
"->",
"BracketOrder",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.oneCancelsAll | Place the trades in the same One Cancels All (OCA) group.
https://interactivebrokers.github.io/tws-api/oca.html
Args:
orders: The orders that are to be placed together. | ib_insync/ib.py | def oneCancelsAll(
orders: List[Order], ocaGroup: str, ocaType: int) -> List[Order]:
"""
Place the trades in the same One Cancels All (OCA) group.
https://interactivebrokers.github.io/tws-api/oca.html
Args:
orders: The orders that are to be placed together.
... | def oneCancelsAll(
orders: List[Order], ocaGroup: str, ocaType: int) -> List[Order]:
"""
Place the trades in the same One Cancels All (OCA) group.
https://interactivebrokers.github.io/tws-api/oca.html
Args:
orders: The orders that are to be placed together.
... | [
"Place",
"the",
"trades",
"in",
"the",
"same",
"One",
"Cancels",
"All",
"(",
"OCA",
")",
"group",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L574-L587 | [
"def",
"oneCancelsAll",
"(",
"orders",
":",
"List",
"[",
"Order",
"]",
",",
"ocaGroup",
":",
"str",
",",
"ocaType",
":",
"int",
")",
"->",
"List",
"[",
"Order",
"]",
":",
"for",
"o",
"in",
"orders",
":",
"o",
".",
"ocaGroup",
"=",
"ocaGroup",
"o",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.whatIfOrder | Retrieve commission and margin impact without actually
placing the order. The given order will not be modified in any way.
This method is blocking.
Args:
contract: Contract to test.
order: Order to test. | ib_insync/ib.py | def whatIfOrder(self, contract: Contract, order: Order) -> OrderState:
"""
Retrieve commission and margin impact without actually
placing the order. The given order will not be modified in any way.
This method is blocking.
Args:
contract: Contract to test.
... | def whatIfOrder(self, contract: Contract, order: Order) -> OrderState:
"""
Retrieve commission and margin impact without actually
placing the order. The given order will not be modified in any way.
This method is blocking.
Args:
contract: Contract to test.
... | [
"Retrieve",
"commission",
"and",
"margin",
"impact",
"without",
"actually",
"placing",
"the",
"order",
".",
"The",
"given",
"order",
"will",
"not",
"be",
"modified",
"in",
"any",
"way",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L589-L600 | [
"def",
"whatIfOrder",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"order",
":",
"Order",
")",
"->",
"OrderState",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"whatIfOrderAsync",
"(",
"contract",
",",
"order",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.placeOrder | Place a new order or modify an existing order.
Returns a Trade that is kept live updated with
status changes, fills, etc.
Args:
contract: Contract to use for order.
order: The order to be placed. | ib_insync/ib.py | def placeOrder(self, contract: Contract, order: Order) -> Trade:
"""
Place a new order or modify an existing order.
Returns a Trade that is kept live updated with
status changes, fills, etc.
Args:
contract: Contract to use for order.
order: The order to b... | def placeOrder(self, contract: Contract, order: Order) -> Trade:
"""
Place a new order or modify an existing order.
Returns a Trade that is kept live updated with
status changes, fills, etc.
Args:
contract: Contract to use for order.
order: The order to b... | [
"Place",
"a",
"new",
"order",
"or",
"modify",
"an",
"existing",
"order",
".",
"Returns",
"a",
"Trade",
"that",
"is",
"kept",
"live",
"updated",
"with",
"status",
"changes",
"fills",
"etc",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L602-L637 | [
"def",
"placeOrder",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"order",
":",
"Order",
")",
"->",
"Trade",
":",
"orderId",
"=",
"order",
".",
"orderId",
"or",
"self",
".",
"client",
".",
"getReqId",
"(",
")",
"self",
".",
"client",
".",
"pla... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelOrder | Cancel the order and return the Trade it belongs to.
Args:
order: The order to be canceled. | ib_insync/ib.py | def cancelOrder(self, order: Order) -> Trade:
"""
Cancel the order and return the Trade it belongs to.
Args:
order: The order to be canceled.
"""
self.client.cancelOrder(order.orderId)
now = datetime.datetime.now(datetime.timezone.utc)
key = self.wrap... | def cancelOrder(self, order: Order) -> Trade:
"""
Cancel the order and return the Trade it belongs to.
Args:
order: The order to be canceled.
"""
self.client.cancelOrder(order.orderId)
now = datetime.datetime.now(datetime.timezone.utc)
key = self.wrap... | [
"Cancel",
"the",
"order",
"and",
"return",
"the",
"Trade",
"it",
"belongs",
"to",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L639-L671 | [
"def",
"cancelOrder",
"(",
"self",
",",
"order",
":",
"Order",
")",
"->",
"Trade",
":",
"self",
".",
"client",
".",
"cancelOrder",
"(",
"order",
".",
"orderId",
")",
"now",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
"datetime",
".",
"timezone",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqAccountUpdatesMulti | It is recommended to use :meth:`.accountValues` instead.
Request account values of multiple accounts and keep updated.
This method is blocking.
Args:
account: If specified, filter for this account name.
modelCode: If specified, filter for this account model. | ib_insync/ib.py | def reqAccountUpdatesMulti(
self, account: str = '', modelCode: str = ''):
"""
It is recommended to use :meth:`.accountValues` instead.
Request account values of multiple accounts and keep updated.
This method is blocking.
Args:
account: If specified, f... | def reqAccountUpdatesMulti(
self, account: str = '', modelCode: str = ''):
"""
It is recommended to use :meth:`.accountValues` instead.
Request account values of multiple accounts and keep updated.
This method is blocking.
Args:
account: If specified, f... | [
"It",
"is",
"recommended",
"to",
"use",
":",
"meth",
":",
".",
"accountValues",
"instead",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L704-L717 | [
"def",
"reqAccountUpdatesMulti",
"(",
"self",
",",
"account",
":",
"str",
"=",
"''",
",",
"modelCode",
":",
"str",
"=",
"''",
")",
":",
"self",
".",
"_run",
"(",
"self",
".",
"reqAccountUpdatesMultiAsync",
"(",
"account",
",",
"modelCode",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqExecutions | It is recommended to use :meth:`.fills` or
:meth:`.executions` instead.
Request and return a list a list of fills.
This method is blocking.
Args:
execFilter: If specified, return executions that match the filter. | ib_insync/ib.py | def reqExecutions(
self, execFilter: ExecutionFilter = None) -> List[Fill]:
"""
It is recommended to use :meth:`.fills` or
:meth:`.executions` instead.
Request and return a list a list of fills.
This method is blocking.
Args:
execFilter: If spe... | def reqExecutions(
self, execFilter: ExecutionFilter = None) -> List[Fill]:
"""
It is recommended to use :meth:`.fills` or
:meth:`.executions` instead.
Request and return a list a list of fills.
This method is blocking.
Args:
execFilter: If spe... | [
"It",
"is",
"recommended",
"to",
"use",
":",
"meth",
":",
".",
"fills",
"or",
":",
"meth",
":",
".",
"executions",
"instead",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L768-L781 | [
"def",
"reqExecutions",
"(",
"self",
",",
"execFilter",
":",
"ExecutionFilter",
"=",
"None",
")",
"->",
"List",
"[",
"Fill",
"]",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"reqExecutionsAsync",
"(",
"execFilter",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqPnL | Start a subscription for profit and loss events.
Returns a :class:`.PnL` object that is kept live updated.
The result can also be queried from :meth:`.pnl`.
https://interactivebrokers.github.io/tws-api/pnl.html
Args:
account: Subscribe to this account.
modelCod... | ib_insync/ib.py | def reqPnL(self, account: str, modelCode: str = '') -> PnL:
"""
Start a subscription for profit and loss events.
Returns a :class:`.PnL` object that is kept live updated.
The result can also be queried from :meth:`.pnl`.
https://interactivebrokers.github.io/tws-api/pnl.html
... | def reqPnL(self, account: str, modelCode: str = '') -> PnL:
"""
Start a subscription for profit and loss events.
Returns a :class:`.PnL` object that is kept live updated.
The result can also be queried from :meth:`.pnl`.
https://interactivebrokers.github.io/tws-api/pnl.html
... | [
"Start",
"a",
"subscription",
"for",
"profit",
"and",
"loss",
"events",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L793-L813 | [
"def",
"reqPnL",
"(",
"self",
",",
"account",
":",
"str",
",",
"modelCode",
":",
"str",
"=",
"''",
")",
"->",
"PnL",
":",
"key",
"=",
"(",
"account",
",",
"modelCode",
")",
"assert",
"key",
"not",
"in",
"self",
".",
"wrapper",
".",
"pnlKey2ReqId",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelPnL | Cancel PnL subscription.
Args:
account: Cancel for this account.
modelCode: If specified, cancel for this account model. | ib_insync/ib.py | def cancelPnL(self, account, modelCode: str = ''):
"""
Cancel PnL subscription.
Args:
account: Cancel for this account.
modelCode: If specified, cancel for this account model.
"""
key = (account, modelCode)
reqId = self.wrapper.pnlKey2ReqId.pop(ke... | def cancelPnL(self, account, modelCode: str = ''):
"""
Cancel PnL subscription.
Args:
account: Cancel for this account.
modelCode: If specified, cancel for this account model.
"""
key = (account, modelCode)
reqId = self.wrapper.pnlKey2ReqId.pop(ke... | [
"Cancel",
"PnL",
"subscription",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L815-L831 | [
"def",
"cancelPnL",
"(",
"self",
",",
"account",
",",
"modelCode",
":",
"str",
"=",
"''",
")",
":",
"key",
"=",
"(",
"account",
",",
"modelCode",
")",
"reqId",
"=",
"self",
".",
"wrapper",
".",
"pnlKey2ReqId",
".",
"pop",
"(",
"key",
",",
"None",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqPnLSingle | Start a subscription for profit and loss events for single positions.
Returns a :class:`.PnLSingle` object that is kept live updated.
The result can also be queried from :meth:`.pnlSingle`.
https://interactivebrokers.github.io/tws-api/pnl.html
Args:
account: Subscribe to t... | ib_insync/ib.py | def reqPnLSingle(
self, account: str, modelCode: str, conId: int) -> PnLSingle:
"""
Start a subscription for profit and loss events for single positions.
Returns a :class:`.PnLSingle` object that is kept live updated.
The result can also be queried from :meth:`.pnlSingle`.
... | def reqPnLSingle(
self, account: str, modelCode: str, conId: int) -> PnLSingle:
"""
Start a subscription for profit and loss events for single positions.
Returns a :class:`.PnLSingle` object that is kept live updated.
The result can also be queried from :meth:`.pnlSingle`.
... | [
"Start",
"a",
"subscription",
"for",
"profit",
"and",
"loss",
"events",
"for",
"single",
"positions",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L833-L855 | [
"def",
"reqPnLSingle",
"(",
"self",
",",
"account",
":",
"str",
",",
"modelCode",
":",
"str",
",",
"conId",
":",
"int",
")",
"->",
"PnLSingle",
":",
"key",
"=",
"(",
"account",
",",
"modelCode",
",",
"conId",
")",
"assert",
"key",
"not",
"in",
"self"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelPnLSingle | Cancel PnLSingle subscription for the given account, modelCode
and conId.
Args:
account: Cancel for this account name.
modelCode: Cancel for this account model.
conId: Cancel for this contract ID. | ib_insync/ib.py | def cancelPnLSingle(
self, account: str, modelCode: str, conId: int):
"""
Cancel PnLSingle subscription for the given account, modelCode
and conId.
Args:
account: Cancel for this account name.
modelCode: Cancel for this account model.
conI... | def cancelPnLSingle(
self, account: str, modelCode: str, conId: int):
"""
Cancel PnLSingle subscription for the given account, modelCode
and conId.
Args:
account: Cancel for this account name.
modelCode: Cancel for this account model.
conI... | [
"Cancel",
"PnLSingle",
"subscription",
"for",
"the",
"given",
"account",
"modelCode",
"and",
"conId",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L857-L876 | [
"def",
"cancelPnLSingle",
"(",
"self",
",",
"account",
":",
"str",
",",
"modelCode",
":",
"str",
",",
"conId",
":",
"int",
")",
":",
"key",
"=",
"(",
"account",
",",
"modelCode",
",",
"conId",
")",
"reqId",
"=",
"self",
".",
"wrapper",
".",
"pnlSingl... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqContractDetails | Get a list of contract details that match the given contract.
If the returned list is empty then the contract is not known;
If the list has multiple values then the contract is ambiguous.
The fully qualified contract is available in the the
ContractDetails.contract attribute.
T... | ib_insync/ib.py | def reqContractDetails(self, contract: Contract) -> List[ContractDetails]:
"""
Get a list of contract details that match the given contract.
If the returned list is empty then the contract is not known;
If the list has multiple values then the contract is ambiguous.
The fully qu... | def reqContractDetails(self, contract: Contract) -> List[ContractDetails]:
"""
Get a list of contract details that match the given contract.
If the returned list is empty then the contract is not known;
If the list has multiple values then the contract is ambiguous.
The fully qu... | [
"Get",
"a",
"list",
"of",
"contract",
"details",
"that",
"match",
"the",
"given",
"contract",
".",
"If",
"the",
"returned",
"list",
"is",
"empty",
"then",
"the",
"contract",
"is",
"not",
"known",
";",
"If",
"the",
"list",
"has",
"multiple",
"values",
"th... | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L878-L894 | [
"def",
"reqContractDetails",
"(",
"self",
",",
"contract",
":",
"Contract",
")",
"->",
"List",
"[",
"ContractDetails",
"]",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"reqContractDetailsAsync",
"(",
"contract",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqMatchingSymbols | Request contract descriptions of contracts that match a pattern.
This method is blocking.
https://interactivebrokers.github.io/tws-api/matching_symbols.html
Args:
pattern: The first few letters of the ticker symbol, or for
longer strings a character sequence matchi... | ib_insync/ib.py | def reqMatchingSymbols(self, pattern: str) -> List[ContractDescription]:
"""
Request contract descriptions of contracts that match a pattern.
This method is blocking.
https://interactivebrokers.github.io/tws-api/matching_symbols.html
Args:
pattern: The first few le... | def reqMatchingSymbols(self, pattern: str) -> List[ContractDescription]:
"""
Request contract descriptions of contracts that match a pattern.
This method is blocking.
https://interactivebrokers.github.io/tws-api/matching_symbols.html
Args:
pattern: The first few le... | [
"Request",
"contract",
"descriptions",
"of",
"contracts",
"that",
"match",
"a",
"pattern",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L896-L909 | [
"def",
"reqMatchingSymbols",
"(",
"self",
",",
"pattern",
":",
"str",
")",
"->",
"List",
"[",
"ContractDescription",
"]",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"reqMatchingSymbolsAsync",
"(",
"pattern",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqMarketRule | Request price increments rule.
https://interactivebrokers.github.io/tws-api/minimum_increment.html
Args:
marketRuleId: ID of market rule.
The market rule IDs for a contract can be obtained
via :meth:`.reqContractDetails` from
:class:`.Contrac... | ib_insync/ib.py | def reqMarketRule(self, marketRuleId: int) -> PriceIncrement:
"""
Request price increments rule.
https://interactivebrokers.github.io/tws-api/minimum_increment.html
Args:
marketRuleId: ID of market rule.
The market rule IDs for a contract can be obtained
... | def reqMarketRule(self, marketRuleId: int) -> PriceIncrement:
"""
Request price increments rule.
https://interactivebrokers.github.io/tws-api/minimum_increment.html
Args:
marketRuleId: ID of market rule.
The market rule IDs for a contract can be obtained
... | [
"Request",
"price",
"increments",
"rule",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L911-L924 | [
"def",
"reqMarketRule",
"(",
"self",
",",
"marketRuleId",
":",
"int",
")",
"->",
"PriceIncrement",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"reqMarketRuleAsync",
"(",
"marketRuleId",
")",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqRealTimeBars | Request realtime 5 second bars.
https://interactivebrokers.github.io/tws-api/realtime_bars.html
Args:
contract: Contract of interest.
barSize: Must be 5.
whatToShow: Specifies the source for constructing bars.
Can be 'TRADES', 'MIDPOINT', 'BID' or 'A... | ib_insync/ib.py | def reqRealTimeBars(
self, contract: Contract, barSize: int,
whatToShow: str, useRTH: bool,
realTimeBarsOptions: List[TagValue] = None) -> RealTimeBarList:
"""
Request realtime 5 second bars.
https://interactivebrokers.github.io/tws-api/realtime_bars.html
... | def reqRealTimeBars(
self, contract: Contract, barSize: int,
whatToShow: str, useRTH: bool,
realTimeBarsOptions: List[TagValue] = None) -> RealTimeBarList:
"""
Request realtime 5 second bars.
https://interactivebrokers.github.io/tws-api/realtime_bars.html
... | [
"Request",
"realtime",
"5",
"second",
"bars",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L926-L955 | [
"def",
"reqRealTimeBars",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"barSize",
":",
"int",
",",
"whatToShow",
":",
"str",
",",
"useRTH",
":",
"bool",
",",
"realTimeBarsOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
")",
"->",
"RealTi... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelRealTimeBars | Cancel the realtime bars subscription.
Args:
bars: The bar list that was obtained from ``reqRealTimeBars``. | ib_insync/ib.py | def cancelRealTimeBars(self, bars: RealTimeBarList):
"""
Cancel the realtime bars subscription.
Args:
bars: The bar list that was obtained from ``reqRealTimeBars``.
"""
self.client.cancelRealTimeBars(bars.reqId)
self.wrapper.endSubscription(bars) | def cancelRealTimeBars(self, bars: RealTimeBarList):
"""
Cancel the realtime bars subscription.
Args:
bars: The bar list that was obtained from ``reqRealTimeBars``.
"""
self.client.cancelRealTimeBars(bars.reqId)
self.wrapper.endSubscription(bars) | [
"Cancel",
"the",
"realtime",
"bars",
"subscription",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L957-L965 | [
"def",
"cancelRealTimeBars",
"(",
"self",
",",
"bars",
":",
"RealTimeBarList",
")",
":",
"self",
".",
"client",
".",
"cancelRealTimeBars",
"(",
"bars",
".",
"reqId",
")",
"self",
".",
"wrapper",
".",
"endSubscription",
"(",
"bars",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqHistoricalData | Request historical bar data.
This method is blocking.
https://interactivebrokers.github.io/tws-api/historical_bars.html
Args:
contract: Contract of interest.
endDateTime: Can be set to '' to indicate the current time,
or it can be given as a datetime.da... | ib_insync/ib.py | def reqHistoricalData(
self, contract: Contract, endDateTime: object,
durationStr: str, barSizeSetting: str,
whatToShow: str, useRTH: bool,
formatDate: int = 1, keepUpToDate: bool = False,
chartOptions: List[TagValue] = None) -> BarDataList:
"""
... | def reqHistoricalData(
self, contract: Contract, endDateTime: object,
durationStr: str, barSizeSetting: str,
whatToShow: str, useRTH: bool,
formatDate: int = 1, keepUpToDate: bool = False,
chartOptions: List[TagValue] = None) -> BarDataList:
"""
... | [
"Request",
"historical",
"bar",
"data",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L967-L1014 | [
"def",
"reqHistoricalData",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"endDateTime",
":",
"object",
",",
"durationStr",
":",
"str",
",",
"barSizeSetting",
":",
"str",
",",
"whatToShow",
":",
"str",
",",
"useRTH",
":",
"bool",
",",
"formatDate",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelHistoricalData | Cancel the update subscription for the historical bars.
Args:
bars: The bar list that was obtained from ``reqHistoricalData``
with a keepUpToDate subscription. | ib_insync/ib.py | def cancelHistoricalData(self, bars: BarDataList):
"""
Cancel the update subscription for the historical bars.
Args:
bars: The bar list that was obtained from ``reqHistoricalData``
with a keepUpToDate subscription.
"""
self.client.cancelHistoricalDat... | def cancelHistoricalData(self, bars: BarDataList):
"""
Cancel the update subscription for the historical bars.
Args:
bars: The bar list that was obtained from ``reqHistoricalData``
with a keepUpToDate subscription.
"""
self.client.cancelHistoricalDat... | [
"Cancel",
"the",
"update",
"subscription",
"for",
"the",
"historical",
"bars",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1016-L1026 | [
"def",
"cancelHistoricalData",
"(",
"self",
",",
"bars",
":",
"BarDataList",
")",
":",
"self",
".",
"client",
".",
"cancelHistoricalData",
"(",
"bars",
".",
"reqId",
")",
"self",
".",
"wrapper",
".",
"endSubscription",
"(",
"bars",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqHistoricalTicks | Request historical ticks. The time resolution of the ticks
is one second.
This method is blocking.
https://interactivebrokers.github.io/tws-api/historical_time_and_sales.html
Args:
contract: Contract to query.
startDateTime: Can be given as a datetime.date or
... | ib_insync/ib.py | def reqHistoricalTicks(
self, contract: Contract,
startDateTime: Union[str, datetime.date],
endDateTime: Union[str, datetime.date],
numberOfTicks: int, whatToShow: str, useRth: bool,
ignoreSize: bool = False,
miscOptions: List[TagValue] = None) -> ... | def reqHistoricalTicks(
self, contract: Contract,
startDateTime: Union[str, datetime.date],
endDateTime: Union[str, datetime.date],
numberOfTicks: int, whatToShow: str, useRth: bool,
ignoreSize: bool = False,
miscOptions: List[TagValue] = None) -> ... | [
"Request",
"historical",
"ticks",
".",
"The",
"time",
"resolution",
"of",
"the",
"ticks",
"is",
"one",
"second",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1028-L1063 | [
"def",
"reqHistoricalTicks",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"startDateTime",
":",
"Union",
"[",
"str",
",",
"datetime",
".",
"date",
"]",
",",
"endDateTime",
":",
"Union",
"[",
"str",
",",
"datetime",
".",
"date",
"]",
",",
"numberOf... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqHeadTimeStamp | Get the datetime of earliest available historical data
for the contract.
Args:
contract: Contract of interest.
useRTH: If True then only show data from within Regular
Trading Hours, if False then show all data.
formatDate: If set to 2 then the result ... | ib_insync/ib.py | def reqHeadTimeStamp(
self, contract: Contract, whatToShow: str,
useRTH: bool, formatDate: int = 1) -> datetime.datetime:
"""
Get the datetime of earliest available historical data
for the contract.
Args:
contract: Contract of interest.
us... | def reqHeadTimeStamp(
self, contract: Contract, whatToShow: str,
useRTH: bool, formatDate: int = 1) -> datetime.datetime:
"""
Get the datetime of earliest available historical data
for the contract.
Args:
contract: Contract of interest.
us... | [
"Get",
"the",
"datetime",
"of",
"earliest",
"available",
"historical",
"data",
"for",
"the",
"contract",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1081-L1097 | [
"def",
"reqHeadTimeStamp",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"whatToShow",
":",
"str",
",",
"useRTH",
":",
"bool",
",",
"formatDate",
":",
"int",
"=",
"1",
")",
"->",
"datetime",
".",
"datetime",
":",
"return",
"self",
".",
"_run",
"(... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqMktData | Subscribe to tick data or request a snapshot.
Returns the Ticker that holds the market data. The ticker will
initially be empty and gradually (after a couple of seconds)
be filled.
https://interactivebrokers.github.io/tws-api/md_request.html
Args:
contract: Contract... | ib_insync/ib.py | def reqMktData(
self, contract: Contract, genericTickList: str = '',
snapshot: bool = False, regulatorySnapshot: bool = False,
mktDataOptions: List[TagValue] = None) -> Ticker:
"""
Subscribe to tick data or request a snapshot.
Returns the Ticker that holds the... | def reqMktData(
self, contract: Contract, genericTickList: str = '',
snapshot: bool = False, regulatorySnapshot: bool = False,
mktDataOptions: List[TagValue] = None) -> Ticker:
"""
Subscribe to tick data or request a snapshot.
Returns the Ticker that holds the... | [
"Subscribe",
"to",
"tick",
"data",
"or",
"request",
"a",
"snapshot",
".",
"Returns",
"the",
"Ticker",
"that",
"holds",
"the",
"market",
"data",
".",
"The",
"ticker",
"will",
"initially",
"be",
"empty",
"and",
"gradually",
"(",
"after",
"a",
"couple",
"of",... | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1099-L1154 | [
"def",
"reqMktData",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"genericTickList",
":",
"str",
"=",
"''",
",",
"snapshot",
":",
"bool",
"=",
"False",
",",
"regulatorySnapshot",
":",
"bool",
"=",
"False",
",",
"mktDataOptions",
":",
"List",
"[",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelMktData | Unsubscribe from realtime streaming tick data.
Args:
contract: The exact contract object that was used to
subscribe with. | ib_insync/ib.py | def cancelMktData(self, contract: Contract):
"""
Unsubscribe from realtime streaming tick data.
Args:
contract: The exact contract object that was used to
subscribe with.
"""
ticker = self.ticker(contract)
reqId = self.wrapper.endTicker(ticker... | def cancelMktData(self, contract: Contract):
"""
Unsubscribe from realtime streaming tick data.
Args:
contract: The exact contract object that was used to
subscribe with.
"""
ticker = self.ticker(contract)
reqId = self.wrapper.endTicker(ticker... | [
"Unsubscribe",
"from",
"realtime",
"streaming",
"tick",
"data",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1156-L1170 | [
"def",
"cancelMktData",
"(",
"self",
",",
"contract",
":",
"Contract",
")",
":",
"ticker",
"=",
"self",
".",
"ticker",
"(",
"contract",
")",
"reqId",
"=",
"self",
".",
"wrapper",
".",
"endTicker",
"(",
"ticker",
",",
"'mktData'",
")",
"if",
"reqId",
":... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqTickByTickData | Subscribe to tick-by-tick data and return the Ticker that
holds the ticks in ticker.tickByTicks.
https://interactivebrokers.github.io/tws-api/tick_data.html
Args:
contract: Contract of interest.
tickType: One of 'Last', 'AllLast', 'BidAsk' or 'MidPoint'.
nu... | ib_insync/ib.py | def reqTickByTickData(
self, contract: Contract, tickType: str,
numberOfTicks: int = 0, ignoreSize: bool = False) -> Ticker:
"""
Subscribe to tick-by-tick data and return the Ticker that
holds the ticks in ticker.tickByTicks.
https://interactivebrokers.github.io/... | def reqTickByTickData(
self, contract: Contract, tickType: str,
numberOfTicks: int = 0, ignoreSize: bool = False) -> Ticker:
"""
Subscribe to tick-by-tick data and return the Ticker that
holds the ticks in ticker.tickByTicks.
https://interactivebrokers.github.io/... | [
"Subscribe",
"to",
"tick",
"-",
"by",
"-",
"tick",
"data",
"and",
"return",
"the",
"Ticker",
"that",
"holds",
"the",
"ticks",
"in",
"ticker",
".",
"tickByTicks",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1172-L1191 | [
"def",
"reqTickByTickData",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"tickType",
":",
"str",
",",
"numberOfTicks",
":",
"int",
"=",
"0",
",",
"ignoreSize",
":",
"bool",
"=",
"False",
")",
"->",
"Ticker",
":",
"reqId",
"=",
"self",
".",
"clie... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelTickByTickData | Unsubscribe from tick-by-tick data
Args:
contract: The exact contract object that was used to
subscribe with. | ib_insync/ib.py | def cancelTickByTickData(self, contract: Contract, tickType: str):
"""
Unsubscribe from tick-by-tick data
Args:
contract: The exact contract object that was used to
subscribe with.
"""
ticker = self.ticker(contract)
reqId = self.wrapper.endTic... | def cancelTickByTickData(self, contract: Contract, tickType: str):
"""
Unsubscribe from tick-by-tick data
Args:
contract: The exact contract object that was used to
subscribe with.
"""
ticker = self.ticker(contract)
reqId = self.wrapper.endTic... | [
"Unsubscribe",
"from",
"tick",
"-",
"by",
"-",
"tick",
"data"
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1193-L1207 | [
"def",
"cancelTickByTickData",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"tickType",
":",
"str",
")",
":",
"ticker",
"=",
"self",
".",
"ticker",
"(",
"contract",
")",
"reqId",
"=",
"self",
".",
"wrapper",
".",
"endTicker",
"(",
"ticker",
",",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqMktDepth | Subscribe to market depth data (a.k.a. DOM, L2 or order book).
https://interactivebrokers.github.io/tws-api/market_depth.html
Args:
contract: Contract of interest.
numRows: Number of depth level on each side of the order book
(5 max).
isSmartDepth: C... | ib_insync/ib.py | def reqMktDepth(
self, contract: Contract, numRows: int = 5,
isSmartDepth: bool = False, mktDepthOptions=None) -> Ticker:
"""
Subscribe to market depth data (a.k.a. DOM, L2 or order book).
https://interactivebrokers.github.io/tws-api/market_depth.html
Args:
... | def reqMktDepth(
self, contract: Contract, numRows: int = 5,
isSmartDepth: bool = False, mktDepthOptions=None) -> Ticker:
"""
Subscribe to market depth data (a.k.a. DOM, L2 or order book).
https://interactivebrokers.github.io/tws-api/market_depth.html
Args:
... | [
"Subscribe",
"to",
"market",
"depth",
"data",
"(",
"a",
".",
"k",
".",
"a",
".",
"DOM",
"L2",
"or",
"order",
"book",
")",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1216-L1240 | [
"def",
"reqMktDepth",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"numRows",
":",
"int",
"=",
"5",
",",
"isSmartDepth",
":",
"bool",
"=",
"False",
",",
"mktDepthOptions",
"=",
"None",
")",
"->",
"Ticker",
":",
"reqId",
"=",
"self",
".",
"client... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelMktDepth | Unsubscribe from market depth data.
Args:
contract: The exact contract object that was used to
subscribe with. | ib_insync/ib.py | def cancelMktDepth(self, contract: Contract, isSmartDepth=False):
"""
Unsubscribe from market depth data.
Args:
contract: The exact contract object that was used to
subscribe with.
"""
ticker = self.ticker(contract)
reqId = self.wrapper.endTic... | def cancelMktDepth(self, contract: Contract, isSmartDepth=False):
"""
Unsubscribe from market depth data.
Args:
contract: The exact contract object that was used to
subscribe with.
"""
ticker = self.ticker(contract)
reqId = self.wrapper.endTic... | [
"Unsubscribe",
"from",
"market",
"depth",
"data",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1242-L1256 | [
"def",
"cancelMktDepth",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"isSmartDepth",
"=",
"False",
")",
":",
"ticker",
"=",
"self",
".",
"ticker",
"(",
"contract",
")",
"reqId",
"=",
"self",
".",
"wrapper",
".",
"endTicker",
"(",
"ticker",
",",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqHistogramData | Request histogram data.
This method is blocking.
https://interactivebrokers.github.io/tws-api/histograms.html
Args:
contract: Contract to query.
useRTH: If True then only show data from within Regular
Trading Hours, if False then show all data.
... | ib_insync/ib.py | def reqHistogramData(
self, contract: Contract,
useRTH: bool, period: str) -> List[HistogramData]:
"""
Request histogram data.
This method is blocking.
https://interactivebrokers.github.io/tws-api/histograms.html
Args:
contract: Contract to ... | def reqHistogramData(
self, contract: Contract,
useRTH: bool, period: str) -> List[HistogramData]:
"""
Request histogram data.
This method is blocking.
https://interactivebrokers.github.io/tws-api/histograms.html
Args:
contract: Contract to ... | [
"Request",
"histogram",
"data",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1258-L1276 | [
"def",
"reqHistogramData",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"useRTH",
":",
"bool",
",",
"period",
":",
"str",
")",
"->",
"List",
"[",
"HistogramData",
"]",
":",
"return",
"self",
".",
"_run",
"(",
"self",
".",
"reqHistogramDataAsync",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqFundamentalData | Get fundamental data of a contract in XML format.
This method is blocking.
https://interactivebrokers.github.io/tws-api/fundamentals.html
Args:
contract: Contract to query.
reportType:
* 'ReportsFinSummary': Financial summary
* 'Reports... | ib_insync/ib.py | def reqFundamentalData(
self, contract: Contract, reportType: str,
fundamentalDataOptions: List[TagValue] = None) -> str:
"""
Get fundamental data of a contract in XML format.
This method is blocking.
https://interactivebrokers.github.io/tws-api/fundamentals.htm... | def reqFundamentalData(
self, contract: Contract, reportType: str,
fundamentalDataOptions: List[TagValue] = None) -> str:
"""
Get fundamental data of a contract in XML format.
This method is blocking.
https://interactivebrokers.github.io/tws-api/fundamentals.htm... | [
"Get",
"fundamental",
"data",
"of",
"a",
"contract",
"in",
"XML",
"format",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1278-L1302 | [
"def",
"reqFundamentalData",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"reportType",
":",
"str",
",",
"fundamentalDataOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
")",
"->",
"str",
":",
"return",
"self",
".",
"_run",
"(",
"self",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqScannerData | Do a blocking market scan by starting a subscription and canceling it
after the initial list of results are in.
This method is blocking.
https://interactivebrokers.github.io/tws-api/market_scanners.html
Args:
subscription: Basic filters.
scannerSubscriptionOpti... | ib_insync/ib.py | def reqScannerData(
self, subscription: ScannerSubscription,
scannerSubscriptionOptions: List[TagValue] = None,
scannerSubscriptionFilterOptions:
List[TagValue] = None) -> ScanDataList:
"""
Do a blocking market scan by starting a subscription and canceling... | def reqScannerData(
self, subscription: ScannerSubscription,
scannerSubscriptionOptions: List[TagValue] = None,
scannerSubscriptionFilterOptions:
List[TagValue] = None) -> ScanDataList:
"""
Do a blocking market scan by starting a subscription and canceling... | [
"Do",
"a",
"blocking",
"market",
"scan",
"by",
"starting",
"a",
"subscription",
"and",
"canceling",
"it",
"after",
"the",
"initial",
"list",
"of",
"results",
"are",
"in",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1304-L1325 | [
"def",
"reqScannerData",
"(",
"self",
",",
"subscription",
":",
"ScannerSubscription",
",",
"scannerSubscriptionOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
",",
"scannerSubscriptionFilterOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
")",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqScannerSubscription | Subscribe to market scan data.
https://interactivebrokers.github.io/tws-api/market_scanners.html
Args:
subscription: What to scan for.
scannerSubscriptionOptions: Unknown.
scannerSubscriptionFilterOptions: Unknown. | ib_insync/ib.py | def reqScannerSubscription(
self, subscription: ScannerSubscription,
scannerSubscriptionOptions: List[TagValue] = None,
scannerSubscriptionFilterOptions:
List[TagValue] = None) -> ScanDataList:
"""
Subscribe to market scan data.
https://interactiv... | def reqScannerSubscription(
self, subscription: ScannerSubscription,
scannerSubscriptionOptions: List[TagValue] = None,
scannerSubscriptionFilterOptions:
List[TagValue] = None) -> ScanDataList:
"""
Subscribe to market scan data.
https://interactiv... | [
"Subscribe",
"to",
"market",
"scan",
"data",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1327-L1353 | [
"def",
"reqScannerSubscription",
"(",
"self",
",",
"subscription",
":",
"ScannerSubscription",
",",
"scannerSubscriptionOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
",",
"scannerSubscriptionFilterOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.cancelScannerSubscription | Cancel market data subscription.
https://interactivebrokers.github.io/tws-api/market_scanners.html
Args:
dataList: The scan data list that was obtained from
:meth:`.reqScannerSubscription`. | ib_insync/ib.py | def cancelScannerSubscription(self, dataList: ScanDataList):
"""
Cancel market data subscription.
https://interactivebrokers.github.io/tws-api/market_scanners.html
Args:
dataList: The scan data list that was obtained from
:meth:`.reqScannerSubscription`.
... | def cancelScannerSubscription(self, dataList: ScanDataList):
"""
Cancel market data subscription.
https://interactivebrokers.github.io/tws-api/market_scanners.html
Args:
dataList: The scan data list that was obtained from
:meth:`.reqScannerSubscription`.
... | [
"Cancel",
"market",
"data",
"subscription",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1355-L1366 | [
"def",
"cancelScannerSubscription",
"(",
"self",
",",
"dataList",
":",
"ScanDataList",
")",
":",
"self",
".",
"client",
".",
"cancelScannerSubscription",
"(",
"dataList",
".",
"reqId",
")",
"self",
".",
"wrapper",
".",
"endSubscription",
"(",
"dataList",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.calculateImpliedVolatility | Calculate the volatility given the option price.
This method is blocking.
https://interactivebrokers.github.io/tws-api/option_computations.html
Args:
contract: Option contract.
optionPrice: Option price to use in calculation.
underPrice: Price of the underl... | ib_insync/ib.py | def calculateImpliedVolatility(
self, contract: Contract,
optionPrice: float, underPrice: float,
implVolOptions: List[TagValue] = None) -> OptionComputation:
"""
Calculate the volatility given the option price.
This method is blocking.
https://intera... | def calculateImpliedVolatility(
self, contract: Contract,
optionPrice: float, underPrice: float,
implVolOptions: List[TagValue] = None) -> OptionComputation:
"""
Calculate the volatility given the option price.
This method is blocking.
https://intera... | [
"Calculate",
"the",
"volatility",
"given",
"the",
"option",
"price",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1376-L1395 | [
"def",
"calculateImpliedVolatility",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"optionPrice",
":",
"float",
",",
"underPrice",
":",
"float",
",",
"implVolOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
")",
"->",
"OptionComputation",
":",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.calculateOptionPrice | Calculate the option price given the volatility.
This method is blocking.
https://interactivebrokers.github.io/tws-api/option_computations.html
Args:
contract: Option contract.
volatility: Option volatility to use in calculation.
underPrice: Price of the un... | ib_insync/ib.py | def calculateOptionPrice(
self, contract: Contract,
volatility: float, underPrice: float,
optPrcOptions=None) -> OptionComputation:
"""
Calculate the option price given the volatility.
This method is blocking.
https://interactivebrokers.github.io/tws... | def calculateOptionPrice(
self, contract: Contract,
volatility: float, underPrice: float,
optPrcOptions=None) -> OptionComputation:
"""
Calculate the option price given the volatility.
This method is blocking.
https://interactivebrokers.github.io/tws... | [
"Calculate",
"the",
"option",
"price",
"given",
"the",
"volatility",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1397-L1416 | [
"def",
"calculateOptionPrice",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"volatility",
":",
"float",
",",
"underPrice",
":",
"float",
",",
"optPrcOptions",
"=",
"None",
")",
"->",
"OptionComputation",
":",
"return",
"self",
".",
"_run",
"(",
"self"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqSecDefOptParams | Get the option chain.
This method is blocking.
https://interactivebrokers.github.io/tws-api/options.html
Args:
underlyingSymbol: Symbol of underlier contract.
futFopExchange: Exchange (only for ``FuturesOption``, otherwise
leave blank).
unde... | ib_insync/ib.py | def reqSecDefOptParams(
self, underlyingSymbol: str,
futFopExchange: str, underlyingSecType: str,
underlyingConId: int) -> List[OptionChain]:
"""
Get the option chain.
This method is blocking.
https://interactivebrokers.github.io/tws-api/options.html... | def reqSecDefOptParams(
self, underlyingSymbol: str,
futFopExchange: str, underlyingSecType: str,
underlyingConId: int) -> List[OptionChain]:
"""
Get the option chain.
This method is blocking.
https://interactivebrokers.github.io/tws-api/options.html... | [
"Get",
"the",
"option",
"chain",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1418-L1440 | [
"def",
"reqSecDefOptParams",
"(",
"self",
",",
"underlyingSymbol",
":",
"str",
",",
"futFopExchange",
":",
"str",
",",
"underlyingSecType",
":",
"str",
",",
"underlyingConId",
":",
"int",
")",
"->",
"List",
"[",
"OptionChain",
"]",
":",
"return",
"self",
"."... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.exerciseOptions | Exercise an options contract.
https://interactivebrokers.github.io/tws-api/options.html
Args:
contract: The option contract to be exercised.
exerciseAction:
* 1 = exercise the option
* 2 = let the option lapse
exerciseQuantity: Number... | ib_insync/ib.py | def exerciseOptions(
self, contract: Contract, exerciseAction: int,
exerciseQuantity: int, account: str, override: int):
"""
Exercise an options contract.
https://interactivebrokers.github.io/tws-api/options.html
Args:
contract: The option contract t... | def exerciseOptions(
self, contract: Contract, exerciseAction: int,
exerciseQuantity: int, account: str, override: int):
"""
Exercise an options contract.
https://interactivebrokers.github.io/tws-api/options.html
Args:
contract: The option contract t... | [
"Exercise",
"an",
"options",
"contract",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1442-L1464 | [
"def",
"exerciseOptions",
"(",
"self",
",",
"contract",
":",
"Contract",
",",
"exerciseAction",
":",
"int",
",",
"exerciseQuantity",
":",
"int",
",",
"account",
":",
"str",
",",
"override",
":",
"int",
")",
":",
"reqId",
"=",
"self",
".",
"client",
".",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqNewsArticle | Get the body of a news article.
This method is blocking.
https://interactivebrokers.github.io/tws-api/news.html
Args:
providerCode: Code indicating news provider, like 'BZ' or 'FLY'.
articleId: ID of the specific article.
newsArticleOptions: Unknown. | ib_insync/ib.py | def reqNewsArticle(
self, providerCode: str, articleId: str,
newsArticleOptions: List[TagValue] = None) -> NewsArticle:
"""
Get the body of a news article.
This method is blocking.
https://interactivebrokers.github.io/tws-api/news.html
Args:
... | def reqNewsArticle(
self, providerCode: str, articleId: str,
newsArticleOptions: List[TagValue] = None) -> NewsArticle:
"""
Get the body of a news article.
This method is blocking.
https://interactivebrokers.github.io/tws-api/news.html
Args:
... | [
"Get",
"the",
"body",
"of",
"a",
"news",
"article",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1474-L1491 | [
"def",
"reqNewsArticle",
"(",
"self",
",",
"providerCode",
":",
"str",
",",
"articleId",
":",
"str",
",",
"newsArticleOptions",
":",
"List",
"[",
"TagValue",
"]",
"=",
"None",
")",
"->",
"NewsArticle",
":",
"return",
"self",
".",
"_run",
"(",
"self",
"."... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.reqHistoricalNews | Get historical news headline.
https://interactivebrokers.github.io/tws-api/news.html
This method is blocking.
Args:
conId: Search news articles for contract with this conId.
providerCodes: A '+'-separated list of provider codes, like
'BZ+FLY'.
... | ib_insync/ib.py | def reqHistoricalNews(
self, conId: int, providerCodes: str,
startDateTime: Union[str, datetime.date],
endDateTime: Union[str, datetime.date],
totalResults: int,
historicalNewsOptions: List[TagValue] = None) -> HistoricalNews:
"""
Get historica... | def reqHistoricalNews(
self, conId: int, providerCodes: str,
startDateTime: Union[str, datetime.date],
endDateTime: Union[str, datetime.date],
totalResults: int,
historicalNewsOptions: List[TagValue] = None) -> HistoricalNews:
"""
Get historica... | [
"Get",
"historical",
"news",
"headline",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1493-L1524 | [
"def",
"reqHistoricalNews",
"(",
"self",
",",
"conId",
":",
"int",
",",
"providerCodes",
":",
"str",
",",
"startDateTime",
":",
"Union",
"[",
"str",
",",
"datetime",
".",
"date",
"]",
",",
"endDateTime",
":",
"Union",
"[",
"str",
",",
"datetime",
".",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | IB.replaceFA | Replaces Financial Advisor's settings.
Args:
faDataType: See :meth:`.requestFA`.
xml: The XML-formatted configuration string. | ib_insync/ib.py | def replaceFA(self, faDataType: int, xml: str):
"""
Replaces Financial Advisor's settings.
Args:
faDataType: See :meth:`.requestFA`.
xml: The XML-formatted configuration string.
"""
self.client.replaceFA(faDataType, xml) | def replaceFA(self, faDataType: int, xml: str):
"""
Replaces Financial Advisor's settings.
Args:
faDataType: See :meth:`.requestFA`.
xml: The XML-formatted configuration string.
"""
self.client.replaceFA(faDataType, xml) | [
"Replaces",
"Financial",
"Advisor",
"s",
"settings",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1563-L1571 | [
"def",
"replaceFA",
"(",
"self",
",",
"faDataType",
":",
"int",
",",
"xml",
":",
"str",
")",
":",
"self",
".",
"client",
".",
"replaceFA",
"(",
"faDataType",
",",
"xml",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | df | Create pandas DataFrame from the sequence of same-type objects.
When a list of labels is given then only retain those labels and
drop the rest. | ib_insync/util.py | def df(objs, labels=None):
"""
Create pandas DataFrame from the sequence of same-type objects.
When a list of labels is given then only retain those labels and
drop the rest.
"""
import pandas as pd
from .objects import Object, DynamicObject
if objs:
objs = list(objs)
obj... | def df(objs, labels=None):
"""
Create pandas DataFrame from the sequence of same-type objects.
When a list of labels is given then only retain those labels and
drop the rest.
"""
import pandas as pd
from .objects import Object, DynamicObject
if objs:
objs = list(objs)
obj... | [
"Create",
"pandas",
"DataFrame",
"from",
"the",
"sequence",
"of",
"same",
"-",
"type",
"objects",
".",
"When",
"a",
"list",
"of",
"labels",
"is",
"given",
"then",
"only",
"retain",
"those",
"labels",
"and",
"drop",
"the",
"rest",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L23-L49 | [
"def",
"df",
"(",
"objs",
",",
"labels",
"=",
"None",
")",
":",
"import",
"pandas",
"as",
"pd",
"from",
".",
"objects",
"import",
"Object",
",",
"DynamicObject",
"if",
"objs",
":",
"objs",
"=",
"list",
"(",
"objs",
")",
"obj",
"=",
"objs",
"[",
"0"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | tree | Convert object to a tree of lists, dicts and simple values.
The result can be serialized to JSON. | ib_insync/util.py | def tree(obj):
"""
Convert object to a tree of lists, dicts and simple values.
The result can be serialized to JSON.
"""
from .objects import Object
if isinstance(obj, (bool, int, float, str, bytes)):
return obj
elif isinstance(obj, (datetime.date, datetime.time)):
return obj... | def tree(obj):
"""
Convert object to a tree of lists, dicts and simple values.
The result can be serialized to JSON.
"""
from .objects import Object
if isinstance(obj, (bool, int, float, str, bytes)):
return obj
elif isinstance(obj, (datetime.date, datetime.time)):
return obj... | [
"Convert",
"object",
"to",
"a",
"tree",
"of",
"lists",
"dicts",
"and",
"simple",
"values",
".",
"The",
"result",
"can",
"be",
"serialized",
"to",
"JSON",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L52-L69 | [
"def",
"tree",
"(",
"obj",
")",
":",
"from",
".",
"objects",
"import",
"Object",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"bool",
",",
"int",
",",
"float",
",",
"str",
",",
"bytes",
")",
")",
":",
"return",
"obj",
"elif",
"isinstance",
"(",
"obj",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | barplot | Create candlestick plot for the given bars. The bars can be given as
a DataFrame or as a list of bar objects. | ib_insync/util.py | def barplot(bars, title='', upColor='blue', downColor='red'):
"""
Create candlestick plot for the given bars. The bars can be given as
a DataFrame or as a list of bar objects.
"""
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patc... | def barplot(bars, title='', upColor='blue', downColor='red'):
"""
Create candlestick plot for the given bars. The bars can be given as
a DataFrame or as a list of bar objects.
"""
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patc... | [
"Create",
"candlestick",
"plot",
"for",
"the",
"given",
"bars",
".",
"The",
"bars",
"can",
"be",
"given",
"as",
"a",
"DataFrame",
"or",
"as",
"a",
"list",
"of",
"bar",
"objects",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L72-L125 | [
"def",
"barplot",
"(",
"bars",
",",
"title",
"=",
"''",
",",
"upColor",
"=",
"'blue'",
",",
"downColor",
"=",
"'red'",
")",
":",
"import",
"pandas",
"as",
"pd",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"from",
"matplotlib",
".",
"lines",
"im... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | logToFile | Create a log handler that logs to the given file. | ib_insync/util.py | def logToFile(path, level=logging.INFO):
"""
Create a log handler that logs to the given file.
"""
logger = logging.getLogger()
logger.setLevel(level)
formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s')
handler = logging.FileHandler(path)
handler.setF... | def logToFile(path, level=logging.INFO):
"""
Create a log handler that logs to the given file.
"""
logger = logging.getLogger()
logger.setLevel(level)
formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s')
handler = logging.FileHandler(path)
handler.setF... | [
"Create",
"a",
"log",
"handler",
"that",
"logs",
"to",
"the",
"given",
"file",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L135-L145 | [
"def",
"logToFile",
"(",
"path",
",",
"level",
"=",
"logging",
".",
"INFO",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"logger",
".",
"setLevel",
"(",
"level",
")",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"'%(asctime)s %(... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | logToConsole | Create a log handler that logs to the console. | ib_insync/util.py | def logToConsole(level=logging.INFO):
"""
Create a log handler that logs to the console.
"""
logger = logging.getLogger()
logger.setLevel(level)
formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s')
handler = logging.StreamHandler()
handler.setFormatter... | def logToConsole(level=logging.INFO):
"""
Create a log handler that logs to the console.
"""
logger = logging.getLogger()
logger.setLevel(level)
formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s')
handler = logging.StreamHandler()
handler.setFormatter... | [
"Create",
"a",
"log",
"handler",
"that",
"logs",
"to",
"the",
"console",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L148-L161 | [
"def",
"logToConsole",
"(",
"level",
"=",
"logging",
".",
"INFO",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"logger",
".",
"setLevel",
"(",
"level",
")",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"'%(asctime)s %(name)s %(level... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | formatSI | Format the integer or float n to 3 significant digits + SI prefix. | ib_insync/util.py | def formatSI(n) -> str:
"""
Format the integer or float n to 3 significant digits + SI prefix.
"""
s = ''
if n < 0:
n = -n
s += '-'
if type(n) is int and n < 1000:
s = str(n) + ' '
elif n < 1e-22:
s = '0.00 '
else:
assert n < 9.99e26
log = ... | def formatSI(n) -> str:
"""
Format the integer or float n to 3 significant digits + SI prefix.
"""
s = ''
if n < 0:
n = -n
s += '-'
if type(n) is int and n < 1000:
s = str(n) + ' '
elif n < 1e-22:
s = '0.00 '
else:
assert n < 9.99e26
log = ... | [
"Format",
"the",
"integer",
"or",
"float",
"n",
"to",
"3",
"significant",
"digits",
"+",
"SI",
"prefix",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L171-L197 | [
"def",
"formatSI",
"(",
"n",
")",
"->",
"str",
":",
"s",
"=",
"''",
"if",
"n",
"<",
"0",
":",
"n",
"=",
"-",
"n",
"s",
"+=",
"'-'",
"if",
"type",
"(",
"n",
")",
"is",
"int",
"and",
"n",
"<",
"1000",
":",
"s",
"=",
"str",
"(",
"n",
")",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | run | By default run the event loop forever.
When awaitables (like Tasks, Futures or coroutines) are given then
run the event loop until each has completed and return their results.
An optional timeout (in seconds) can be given that will raise
asyncio.TimeoutError if the awaitables are not ready within the
... | ib_insync/util.py | def run(*awaitables, timeout: float = None):
"""
By default run the event loop forever.
When awaitables (like Tasks, Futures or coroutines) are given then
run the event loop until each has completed and return their results.
An optional timeout (in seconds) can be given that will raise
asyncio... | def run(*awaitables, timeout: float = None):
"""
By default run the event loop forever.
When awaitables (like Tasks, Futures or coroutines) are given then
run the event loop until each has completed and return their results.
An optional timeout (in seconds) can be given that will raise
asyncio... | [
"By",
"default",
"run",
"the",
"event",
"loop",
"forever",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L214-L257 | [
"def",
"run",
"(",
"*",
"awaitables",
",",
"timeout",
":",
"float",
"=",
"None",
")",
":",
"loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")",
"if",
"not",
"awaitables",
":",
"if",
"loop",
".",
"is_running",
"(",
")",
":",
"return",
"loop",
".",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | schedule | Schedule the callback to be run at the given time with
the given arguments.
Args:
time: Time to run callback. If given as :py:class:`datetime.time`
then use today as date.
callback: Callable scheduled to run.
args: Arguments for to call callback with. | ib_insync/util.py | def schedule(
time: Union[datetime.time, datetime.datetime],
callback: Callable, *args):
"""
Schedule the callback to be run at the given time with
the given arguments.
Args:
time: Time to run callback. If given as :py:class:`datetime.time`
then use today as date.
... | def schedule(
time: Union[datetime.time, datetime.datetime],
callback: Callable, *args):
"""
Schedule the callback to be run at the given time with
the given arguments.
Args:
time: Time to run callback. If given as :py:class:`datetime.time`
then use today as date.
... | [
"Schedule",
"the",
"callback",
"to",
"be",
"run",
"at",
"the",
"given",
"time",
"with",
"the",
"given",
"arguments",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L269-L286 | [
"def",
"schedule",
"(",
"time",
":",
"Union",
"[",
"datetime",
".",
"time",
",",
"datetime",
".",
"datetime",
"]",
",",
"callback",
":",
"Callable",
",",
"*",
"args",
")",
":",
"dt",
"=",
"_fillDate",
"(",
"time",
")",
"now",
"=",
"datetime",
".",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | timeRange | Iterator that waits periodically until certain time points are
reached while yielding those time points.
Args:
start: Start time, can be specified as datetime.datetime,
or as datetime.time in which case today is used as the date
end: End time, can be specified as datetime.datetime,
... | ib_insync/util.py | def timeRange(
start: datetime.time, end: datetime.time,
step: float) -> Iterator[datetime.datetime]:
"""
Iterator that waits periodically until certain time points are
reached while yielding those time points.
Args:
start: Start time, can be specified as datetime.datetime,
... | def timeRange(
start: datetime.time, end: datetime.time,
step: float) -> Iterator[datetime.datetime]:
"""
Iterator that waits periodically until certain time points are
reached while yielding those time points.
Args:
start: Start time, can be specified as datetime.datetime,
... | [
"Iterator",
"that",
"waits",
"periodically",
"until",
"certain",
"time",
"points",
"are",
"reached",
"while",
"yielding",
"those",
"time",
"points",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L301-L325 | [
"def",
"timeRange",
"(",
"start",
":",
"datetime",
".",
"time",
",",
"end",
":",
"datetime",
".",
"time",
",",
"step",
":",
"float",
")",
"->",
"Iterator",
"[",
"datetime",
".",
"datetime",
"]",
":",
"assert",
"step",
">",
"0",
"start",
"=",
"_fillDa... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | timeRangeAsync | Async version of :meth:`timeRange`. | ib_insync/util.py | async def timeRangeAsync(
start: datetime.time, end: datetime.time,
step: float) -> AsyncIterator[datetime.datetime]:
"""
Async version of :meth:`timeRange`.
"""
assert step > 0
start = _fillDate(start)
end = _fillDate(end)
delta = datetime.timedelta(seconds=step)
t = sta... | async def timeRangeAsync(
start: datetime.time, end: datetime.time,
step: float) -> AsyncIterator[datetime.datetime]:
"""
Async version of :meth:`timeRange`.
"""
assert step > 0
start = _fillDate(start)
end = _fillDate(end)
delta = datetime.timedelta(seconds=step)
t = sta... | [
"Async",
"version",
"of",
":",
"meth",
":",
"timeRange",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L343-L359 | [
"async",
"def",
"timeRangeAsync",
"(",
"start",
":",
"datetime",
".",
"time",
",",
"end",
":",
"datetime",
".",
"time",
",",
"step",
":",
"float",
")",
"->",
"AsyncIterator",
"[",
"datetime",
".",
"datetime",
"]",
":",
"assert",
"step",
">",
"0",
"star... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | waitUntilAsync | Async version of :meth:`waitUntil`. | ib_insync/util.py | async def waitUntilAsync(t: datetime.time) -> bool:
"""
Async version of :meth:`waitUntil`.
"""
t = _fillDate(t)
now = datetime.datetime.now(t.tzinfo)
secs = (t - now).total_seconds()
await asyncio.sleep(secs)
return True | async def waitUntilAsync(t: datetime.time) -> bool:
"""
Async version of :meth:`waitUntil`.
"""
t = _fillDate(t)
now = datetime.datetime.now(t.tzinfo)
secs = (t - now).total_seconds()
await asyncio.sleep(secs)
return True | [
"Async",
"version",
"of",
":",
"meth",
":",
"waitUntil",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L362-L370 | [
"async",
"def",
"waitUntilAsync",
"(",
"t",
":",
"datetime",
".",
"time",
")",
"->",
"bool",
":",
"t",
"=",
"_fillDate",
"(",
"t",
")",
"now",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
"t",
".",
"tzinfo",
")",
"secs",
"=",
"(",
"t",
"-",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | startLoop | Use nested asyncio event loop for Jupyter notebooks. | ib_insync/util.py | def startLoop():
"""
Use nested asyncio event loop for Jupyter notebooks.
"""
def _ipython_loop_asyncio(kernel):
'''
Use asyncio event loop for the given IPython kernel.
'''
loop = asyncio.get_event_loop()
def kernel_handler():
kernel.do_one_iteration... | def startLoop():
"""
Use nested asyncio event loop for Jupyter notebooks.
"""
def _ipython_loop_asyncio(kernel):
'''
Use asyncio event loop for the given IPython kernel.
'''
loop = asyncio.get_event_loop()
def kernel_handler():
kernel.do_one_iteration... | [
"Use",
"nested",
"asyncio",
"event",
"loop",
"for",
"Jupyter",
"notebooks",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L381-L409 | [
"def",
"startLoop",
"(",
")",
":",
"def",
"_ipython_loop_asyncio",
"(",
"kernel",
")",
":",
"'''\n Use asyncio event loop for the given IPython kernel.\n '''",
"loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")",
"def",
"kernel_handler",
"(",
")",
":",... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | useQt | Run combined Qt5/asyncio event loop.
Args:
qtLib: Name of Qt library to use, can be 'PyQt5' or 'PySide2'.
period: Period in seconds to poll Qt. | ib_insync/util.py | def useQt(qtLib: str = 'PyQt5', period: float = 0.01):
"""
Run combined Qt5/asyncio event loop.
Args:
qtLib: Name of Qt library to use, can be 'PyQt5' or 'PySide2'.
period: Period in seconds to poll Qt.
"""
def qt_step():
loop.call_later(period, qt_step)
if not stack... | def useQt(qtLib: str = 'PyQt5', period: float = 0.01):
"""
Run combined Qt5/asyncio event loop.
Args:
qtLib: Name of Qt library to use, can be 'PyQt5' or 'PySide2'.
period: Period in seconds to poll Qt.
"""
def qt_step():
loop.call_later(period, qt_step)
if not stack... | [
"Run",
"combined",
"Qt5",
"/",
"asyncio",
"event",
"loop",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L412-L444 | [
"def",
"useQt",
"(",
"qtLib",
":",
"str",
"=",
"'PyQt5'",
",",
"period",
":",
"float",
"=",
"0.01",
")",
":",
"def",
"qt_step",
"(",
")",
":",
"loop",
".",
"call_later",
"(",
"period",
",",
"qt_step",
")",
"if",
"not",
"stack",
":",
"qloop",
"=",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | formatIBDatetime | Format date or datetime to string that IB uses. | ib_insync/util.py | def formatIBDatetime(dt) -> str:
"""
Format date or datetime to string that IB uses.
"""
if not dt:
s = ''
elif isinstance(dt, datetime.datetime):
if dt.tzinfo:
# convert to local system timezone
dt = dt.astimezone()
s = dt.strftime('%Y%m%d %H:%M:%S')
... | def formatIBDatetime(dt) -> str:
"""
Format date or datetime to string that IB uses.
"""
if not dt:
s = ''
elif isinstance(dt, datetime.datetime):
if dt.tzinfo:
# convert to local system timezone
dt = dt.astimezone()
s = dt.strftime('%Y%m%d %H:%M:%S')
... | [
"Format",
"date",
"or",
"datetime",
"to",
"string",
"that",
"IB",
"uses",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L447-L462 | [
"def",
"formatIBDatetime",
"(",
"dt",
")",
"->",
"str",
":",
"if",
"not",
"dt",
":",
"s",
"=",
"''",
"elif",
"isinstance",
"(",
"dt",
",",
"datetime",
".",
"datetime",
")",
":",
"if",
"dt",
".",
"tzinfo",
":",
"# convert to local system timezone",
"dt",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | parseIBDatetime | Parse string in IB date or datetime format to datetime. | ib_insync/util.py | def parseIBDatetime(s):
"""
Parse string in IB date or datetime format to datetime.
"""
if len(s) == 8:
# YYYYmmdd
y = int(s[0:4])
m = int(s[4:6])
d = int(s[6:8])
dt = datetime.date(y, m, d)
elif s.isdigit():
dt = datetime.datetime.fromtimestamp(
... | def parseIBDatetime(s):
"""
Parse string in IB date or datetime format to datetime.
"""
if len(s) == 8:
# YYYYmmdd
y = int(s[0:4])
m = int(s[4:6])
d = int(s[6:8])
dt = datetime.date(y, m, d)
elif s.isdigit():
dt = datetime.datetime.fromtimestamp(
... | [
"Parse",
"string",
"in",
"IB",
"date",
"or",
"datetime",
"format",
"to",
"datetime",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/util.py#L465-L480 | [
"def",
"parseIBDatetime",
"(",
"s",
")",
":",
"if",
"len",
"(",
"s",
")",
"==",
"8",
":",
"# YYYYmmdd",
"y",
"=",
"int",
"(",
"s",
"[",
"0",
":",
"4",
"]",
")",
"m",
"=",
"int",
"(",
"s",
"[",
"4",
":",
"6",
"]",
")",
"d",
"=",
"int",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Object.tuple | Return values as a tuple. | ib_insync/objects.py | def tuple(self):
"""
Return values as a tuple.
"""
return tuple(getattr(self, k) for k in self.__class__.defaults) | def tuple(self):
"""
Return values as a tuple.
"""
return tuple(getattr(self, k) for k in self.__class__.defaults) | [
"Return",
"values",
"as",
"a",
"tuple",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/objects.py#L61-L65 | [
"def",
"tuple",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"getattr",
"(",
"self",
",",
"k",
")",
"for",
"k",
"in",
"self",
".",
"__class__",
".",
"defaults",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Object.dict | Return key-value pairs as a dictionary. | ib_insync/objects.py | def dict(self):
"""
Return key-value pairs as a dictionary.
"""
return {k: getattr(self, k) for k in self.__class__.defaults} | def dict(self):
"""
Return key-value pairs as a dictionary.
"""
return {k: getattr(self, k) for k in self.__class__.defaults} | [
"Return",
"key",
"-",
"value",
"pairs",
"as",
"a",
"dictionary",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/objects.py#L67-L71 | [
"def",
"dict",
"(",
"self",
")",
":",
"return",
"{",
"k",
":",
"getattr",
"(",
"self",
",",
"k",
")",
"for",
"k",
"in",
"self",
".",
"__class__",
".",
"defaults",
"}"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Object.diff | Return differences between self and other as dictionary of 2-tuples. | ib_insync/objects.py | def diff(self, other):
"""
Return differences between self and other as dictionary of 2-tuples.
"""
diff = {}
for k in self.__class__.defaults:
left = getattr(self, k)
right = getattr(other, k)
if left != right:
diff[k] = (left,... | def diff(self, other):
"""
Return differences between self and other as dictionary of 2-tuples.
"""
diff = {}
for k in self.__class__.defaults:
left = getattr(self, k)
right = getattr(other, k)
if left != right:
diff[k] = (left,... | [
"Return",
"differences",
"between",
"self",
"and",
"other",
"as",
"dictionary",
"of",
"2",
"-",
"tuples",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/objects.py#L81-L91 | [
"def",
"diff",
"(",
"self",
",",
"other",
")",
":",
"diff",
"=",
"{",
"}",
"for",
"k",
"in",
"self",
".",
"__class__",
".",
"defaults",
":",
"left",
"=",
"getattr",
"(",
"self",
",",
"k",
")",
"right",
"=",
"getattr",
"(",
"other",
",",
"k",
")... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Object.nonDefaults | Get a dictionary of all attributes that differ from the default. | ib_insync/objects.py | def nonDefaults(self):
"""
Get a dictionary of all attributes that differ from the default.
"""
nonDefaults = {}
for k, d in self.__class__.defaults.items():
v = getattr(self, k)
if v != d and (v == v or d == d): # tests for NaN too
nonDef... | def nonDefaults(self):
"""
Get a dictionary of all attributes that differ from the default.
"""
nonDefaults = {}
for k, d in self.__class__.defaults.items():
v = getattr(self, k)
if v != d and (v == v or d == d): # tests for NaN too
nonDef... | [
"Get",
"a",
"dictionary",
"of",
"all",
"attributes",
"that",
"differ",
"from",
"the",
"default",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/objects.py#L93-L102 | [
"def",
"nonDefaults",
"(",
"self",
")",
":",
"nonDefaults",
"=",
"{",
"}",
"for",
"k",
",",
"d",
"in",
"self",
".",
"__class__",
".",
"defaults",
".",
"items",
"(",
")",
":",
"v",
"=",
"getattr",
"(",
"self",
",",
"k",
")",
"if",
"v",
"!=",
"d"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper.startReq | Start a new request and return the future that is associated
with with the key and container. The container is a list by default. | ib_insync/wrapper.py | def startReq(self, key, contract=None, container=None):
"""
Start a new request and return the future that is associated
with with the key and container. The container is a list by default.
"""
future = asyncio.Future()
self._futures[key] = future
self._results[ke... | def startReq(self, key, contract=None, container=None):
"""
Start a new request and return the future that is associated
with with the key and container. The container is a list by default.
"""
future = asyncio.Future()
self._futures[key] = future
self._results[ke... | [
"Start",
"a",
"new",
"request",
"and",
"return",
"the",
"future",
"that",
"is",
"associated",
"with",
"with",
"the",
"key",
"and",
"container",
".",
"The",
"container",
"is",
"a",
"list",
"by",
"default",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L76-L86 | [
"def",
"startReq",
"(",
"self",
",",
"key",
",",
"contract",
"=",
"None",
",",
"container",
"=",
"None",
")",
":",
"future",
"=",
"asyncio",
".",
"Future",
"(",
")",
"self",
".",
"_futures",
"[",
"key",
"]",
"=",
"future",
"self",
".",
"_results",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper._endReq | Finish the future of corresponding key with the given result.
If no result is given then it will be popped of the general results. | ib_insync/wrapper.py | def _endReq(self, key, result=None, success=True):
"""
Finish the future of corresponding key with the given result.
If no result is given then it will be popped of the general results.
"""
future = self._futures.pop(key, None)
self._reqId2Contract.pop(key, None)
... | def _endReq(self, key, result=None, success=True):
"""
Finish the future of corresponding key with the given result.
If no result is given then it will be popped of the general results.
"""
future = self._futures.pop(key, None)
self._reqId2Contract.pop(key, None)
... | [
"Finish",
"the",
"future",
"of",
"corresponding",
"key",
"with",
"the",
"given",
"result",
".",
"If",
"no",
"result",
"is",
"given",
"then",
"it",
"will",
"be",
"popped",
"of",
"the",
"general",
"results",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L88-L102 | [
"def",
"_endReq",
"(",
"self",
",",
"key",
",",
"result",
"=",
"None",
",",
"success",
"=",
"True",
")",
":",
"future",
"=",
"self",
".",
"_futures",
".",
"pop",
"(",
"key",
",",
"None",
")",
"self",
".",
"_reqId2Contract",
".",
"pop",
"(",
"key",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper.startTicker | Start a tick request that has the reqId associated with the contract.
Return the ticker. | ib_insync/wrapper.py | def startTicker(self, reqId, contract, tickType):
"""
Start a tick request that has the reqId associated with the contract.
Return the ticker.
"""
ticker = self.tickers.get(id(contract))
if not ticker:
ticker = Ticker(
contract=contract, ticks=... | def startTicker(self, reqId, contract, tickType):
"""
Start a tick request that has the reqId associated with the contract.
Return the ticker.
"""
ticker = self.tickers.get(id(contract))
if not ticker:
ticker = Ticker(
contract=contract, ticks=... | [
"Start",
"a",
"tick",
"request",
"that",
"has",
"the",
"reqId",
"associated",
"with",
"the",
"contract",
".",
"Return",
"the",
"ticker",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L104-L118 | [
"def",
"startTicker",
"(",
"self",
",",
"reqId",
",",
"contract",
",",
"tickType",
")",
":",
"ticker",
"=",
"self",
".",
"tickers",
".",
"get",
"(",
"id",
"(",
"contract",
")",
")",
"if",
"not",
"ticker",
":",
"ticker",
"=",
"Ticker",
"(",
"contract"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper.startSubscription | Register a live subscription. | ib_insync/wrapper.py | def startSubscription(self, reqId, subscriber, contract=None):
"""
Register a live subscription.
"""
self._reqId2Contract[reqId] = contract
self.reqId2Subscriber[reqId] = subscriber | def startSubscription(self, reqId, subscriber, contract=None):
"""
Register a live subscription.
"""
self._reqId2Contract[reqId] = contract
self.reqId2Subscriber[reqId] = subscriber | [
"Register",
"a",
"live",
"subscription",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L125-L130 | [
"def",
"startSubscription",
"(",
"self",
",",
"reqId",
",",
"subscriber",
",",
"contract",
"=",
"None",
")",
":",
"self",
".",
"_reqId2Contract",
"[",
"reqId",
"]",
"=",
"contract",
"self",
".",
"reqId2Subscriber",
"[",
"reqId",
"]",
"=",
"subscriber"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper.endSubscription | Unregister a live subscription. | ib_insync/wrapper.py | def endSubscription(self, subscriber):
"""
Unregister a live subscription.
"""
self._reqId2Contract.pop(subscriber.reqId, None)
self.reqId2Subscriber.pop(subscriber.reqId, None) | def endSubscription(self, subscriber):
"""
Unregister a live subscription.
"""
self._reqId2Contract.pop(subscriber.reqId, None)
self.reqId2Subscriber.pop(subscriber.reqId, None) | [
"Unregister",
"a",
"live",
"subscription",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L132-L137 | [
"def",
"endSubscription",
"(",
"self",
",",
"subscriber",
")",
":",
"self",
".",
"_reqId2Contract",
".",
"pop",
"(",
"subscriber",
".",
"reqId",
",",
"None",
")",
"self",
".",
"reqId2Subscriber",
".",
"pop",
"(",
"subscriber",
".",
"reqId",
",",
"None",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper.openOrder | This wrapper is called to:
* feed in open orders at startup;
* feed in open orders or order updates from other clients and TWS
if clientId=master id;
* feed in manual orders and order updates from TWS if clientId=0;
* handle openOrders and allOpenOrders responses. | ib_insync/wrapper.py | def openOrder(self, orderId, contract, order, orderState):
"""
This wrapper is called to:
* feed in open orders at startup;
* feed in open orders or order updates from other clients and TWS
if clientId=master id;
* feed in manual orders and order updates from TWS if cl... | def openOrder(self, orderId, contract, order, orderState):
"""
This wrapper is called to:
* feed in open orders at startup;
* feed in open orders or order updates from other clients and TWS
if clientId=master id;
* feed in manual orders and order updates from TWS if cl... | [
"This",
"wrapper",
"is",
"called",
"to",
":"
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L267-L299 | [
"def",
"openOrder",
"(",
"self",
",",
"orderId",
",",
"contract",
",",
"order",
",",
"orderState",
")",
":",
"if",
"order",
".",
"whatIf",
":",
"# response to whatIfOrder",
"self",
".",
"_endReq",
"(",
"order",
".",
"orderId",
",",
"orderState",
")",
"else... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Wrapper.execDetails | This wrapper handles both live fills and responses to reqExecutions. | ib_insync/wrapper.py | def execDetails(self, reqId, contract, execution):
"""
This wrapper handles both live fills and responses to reqExecutions.
"""
if execution.orderId == UNSET_INTEGER:
# bug in TWS: executions of manual orders have unset value
execution.orderId = 0
key = se... | def execDetails(self, reqId, contract, execution):
"""
This wrapper handles both live fills and responses to reqExecutions.
"""
if execution.orderId == UNSET_INTEGER:
# bug in TWS: executions of manual orders have unset value
execution.orderId = 0
key = se... | [
"This",
"wrapper",
"handles",
"both",
"live",
"fills",
"and",
"responses",
"to",
"reqExecutions",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/wrapper.py#L347-L382 | [
"def",
"execDetails",
"(",
"self",
",",
"reqId",
",",
"contract",
",",
"execution",
")",
":",
"if",
"execution",
".",
"orderId",
"==",
"UNSET_INTEGER",
":",
"# bug in TWS: executions of manual orders have unset value",
"execution",
".",
"orderId",
"=",
"0",
"key",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Client.connectionStats | Get statistics about the connection. | ib_insync/client.py | def connectionStats(self) -> ConnectionStats:
"""
Get statistics about the connection.
"""
if not self.isReady():
raise ConnectionError('Not connected')
return ConnectionStats(
self._startTime,
time.time() - self._startTime,
self._n... | def connectionStats(self) -> ConnectionStats:
"""
Get statistics about the connection.
"""
if not self.isReady():
raise ConnectionError('Not connected')
return ConnectionStats(
self._startTime,
time.time() - self._startTime,
self._n... | [
"Get",
"statistics",
"about",
"the",
"connection",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/client.py#L137-L147 | [
"def",
"connectionStats",
"(",
"self",
")",
"->",
"ConnectionStats",
":",
"if",
"not",
"self",
".",
"isReady",
"(",
")",
":",
"raise",
"ConnectionError",
"(",
"'Not connected'",
")",
"return",
"ConnectionStats",
"(",
"self",
".",
"_startTime",
",",
"time",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Client.getReqId | Get new request ID. | ib_insync/client.py | def getReqId(self) -> int:
"""
Get new request ID.
"""
if not self.isReady():
raise ConnectionError('Not connected')
newId = self._reqIdSeq
self._reqIdSeq += 1
return newId | def getReqId(self) -> int:
"""
Get new request ID.
"""
if not self.isReady():
raise ConnectionError('Not connected')
newId = self._reqIdSeq
self._reqIdSeq += 1
return newId | [
"Get",
"new",
"request",
"ID",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/client.py#L149-L157 | [
"def",
"getReqId",
"(",
"self",
")",
"->",
"int",
":",
"if",
"not",
"self",
".",
"isReady",
"(",
")",
":",
"raise",
"ConnectionError",
"(",
"'Not connected'",
")",
"newId",
"=",
"self",
".",
"_reqIdSeq",
"self",
".",
"_reqIdSeq",
"+=",
"1",
"return",
"... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Client.disconnect | Disconnect from IB connection. | ib_insync/client.py | def disconnect(self):
"""
Disconnect from IB connection.
"""
self.connState = Client.DISCONNECTED
if self.conn is not None:
self._logger.info('Disconnecting')
self.conn.disconnect()
self.wrapper.connectionClosed()
self.reset() | def disconnect(self):
"""
Disconnect from IB connection.
"""
self.connState = Client.DISCONNECTED
if self.conn is not None:
self._logger.info('Disconnecting')
self.conn.disconnect()
self.wrapper.connectionClosed()
self.reset() | [
"Disconnect",
"from",
"IB",
"connection",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/client.py#L222-L231 | [
"def",
"disconnect",
"(",
"self",
")",
":",
"self",
".",
"connState",
"=",
"Client",
".",
"DISCONNECTED",
"if",
"self",
".",
"conn",
"is",
"not",
"None",
":",
"self",
".",
"_logger",
".",
"info",
"(",
"'Disconnecting'",
")",
"self",
".",
"conn",
".",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Client.send | Serialize and send the given fields using the IB socket protocol. | ib_insync/client.py | def send(self, *fields):
"""
Serialize and send the given fields using the IB socket protocol.
"""
if not self.isConnected():
raise ConnectionError('Not connected')
msg = io.StringIO()
for field in fields:
typ = type(field)
if field in... | def send(self, *fields):
"""
Serialize and send the given fields using the IB socket protocol.
"""
if not self.isConnected():
raise ConnectionError('Not connected')
msg = io.StringIO()
for field in fields:
typ = type(field)
if field in... | [
"Serialize",
"and",
"send",
"the",
"given",
"fields",
"using",
"the",
"IB",
"socket",
"protocol",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/client.py#L233-L264 | [
"def",
"send",
"(",
"self",
",",
"*",
"fields",
")",
":",
"if",
"not",
"self",
".",
"isConnected",
"(",
")",
":",
"raise",
"ConnectionError",
"(",
"'Not connected'",
")",
"msg",
"=",
"io",
".",
"StringIO",
"(",
")",
"for",
"field",
"in",
"fields",
":... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Decoder.wrap | Create a message handler that invokes a wrapper method
with the in-order message fields as parameters, skipping over
the first ``skip`` fields, and parsed according to the ``types`` list. | ib_insync/decoder.py | def wrap(self, methodName, types, skip=2):
"""
Create a message handler that invokes a wrapper method
with the in-order message fields as parameters, skipping over
the first ``skip`` fields, and parsed according to the ``types`` list.
"""
def handler(fields):
... | def wrap(self, methodName, types, skip=2):
"""
Create a message handler that invokes a wrapper method
with the in-order message fields as parameters, skipping over
the first ``skip`` fields, and parsed according to the ``types`` list.
"""
def handler(fields):
... | [
"Create",
"a",
"message",
"handler",
"that",
"invokes",
"a",
"wrapper",
"method",
"with",
"the",
"in",
"-",
"order",
"message",
"fields",
"as",
"parameters",
"skipping",
"over",
"the",
"first",
"skip",
"fields",
"and",
"parsed",
"according",
"to",
"the",
"ty... | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/decoder.py#L159-L179 | [
"def",
"wrap",
"(",
"self",
",",
"methodName",
",",
"types",
",",
"skip",
"=",
"2",
")",
":",
"def",
"handler",
"(",
"fields",
")",
":",
"try",
":",
"args",
"=",
"[",
"field",
"if",
"typ",
"is",
"str",
"else",
"int",
"(",
"field",
"or",
"0",
")... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Decoder.interpret | Decode fields and invoke corresponding wrapper method. | ib_insync/decoder.py | def interpret(self, fields):
"""
Decode fields and invoke corresponding wrapper method.
"""
try:
msgId = int(fields[0])
handler = self.handlers[msgId]
handler(fields)
except Exception:
self.logger.exception(f'Error handling fields: ... | def interpret(self, fields):
"""
Decode fields and invoke corresponding wrapper method.
"""
try:
msgId = int(fields[0])
handler = self.handlers[msgId]
handler(fields)
except Exception:
self.logger.exception(f'Error handling fields: ... | [
"Decode",
"fields",
"and",
"invoke",
"corresponding",
"wrapper",
"method",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/decoder.py#L181-L190 | [
"def",
"interpret",
"(",
"self",
",",
"fields",
")",
":",
"try",
":",
"msgId",
"=",
"int",
"(",
"fields",
"[",
"0",
"]",
")",
"handler",
"=",
"self",
".",
"handlers",
"[",
"msgId",
"]",
"handler",
"(",
"fields",
")",
"except",
"Exception",
":",
"se... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | Decoder.parse | Parse the object's properties according to its default types. | ib_insync/decoder.py | def parse(self, obj):
"""
Parse the object's properties according to its default types.
"""
for k, default in obj.__class__.defaults.items():
typ = type(default)
if typ is str:
continue
v = getattr(obj, k)
if typ is int:
... | def parse(self, obj):
"""
Parse the object's properties according to its default types.
"""
for k, default in obj.__class__.defaults.items():
typ = type(default)
if typ is str:
continue
v = getattr(obj, k)
if typ is int:
... | [
"Parse",
"the",
"object",
"s",
"properties",
"according",
"to",
"its",
"default",
"types",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/decoder.py#L192-L206 | [
"def",
"parse",
"(",
"self",
",",
"obj",
")",
":",
"for",
"k",
",",
"default",
"in",
"obj",
".",
"__class__",
".",
"defaults",
".",
"items",
"(",
")",
":",
"typ",
"=",
"type",
"(",
"default",
")",
"if",
"typ",
"is",
"str",
":",
"continue",
"v",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | FlexReport.topics | Get the set of topics that can be extracted from this report. | ib_insync/flexreport.py | def topics(self):
"""
Get the set of topics that can be extracted from this report.
"""
return set(node.tag for node in self.root.iter() if node.attrib) | def topics(self):
"""
Get the set of topics that can be extracted from this report.
"""
return set(node.tag for node in self.root.iter() if node.attrib) | [
"Get",
"the",
"set",
"of",
"topics",
"that",
"can",
"be",
"extracted",
"from",
"this",
"report",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/flexreport.py#L49-L53 | [
"def",
"topics",
"(",
"self",
")",
":",
"return",
"set",
"(",
"node",
".",
"tag",
"for",
"node",
"in",
"self",
".",
"root",
".",
"iter",
"(",
")",
"if",
"node",
".",
"attrib",
")"
] | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
train | FlexReport.extract | Extract items of given topic and return as list of objects.
The topic is a string like TradeConfirm, ChangeInDividendAccrual,
Order, etc. | ib_insync/flexreport.py | def extract(self, topic: str, parseNumbers=True) -> list:
"""
Extract items of given topic and return as list of objects.
The topic is a string like TradeConfirm, ChangeInDividendAccrual,
Order, etc.
"""
cls = type(topic, (DynamicObject,), {})
results = [cls(**no... | def extract(self, topic: str, parseNumbers=True) -> list:
"""
Extract items of given topic and return as list of objects.
The topic is a string like TradeConfirm, ChangeInDividendAccrual,
Order, etc.
"""
cls = type(topic, (DynamicObject,), {})
results = [cls(**no... | [
"Extract",
"items",
"of",
"given",
"topic",
"and",
"return",
"as",
"list",
"of",
"objects",
"."
] | erdewit/ib_insync | python | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/flexreport.py#L55-L71 | [
"def",
"extract",
"(",
"self",
",",
"topic",
":",
"str",
",",
"parseNumbers",
"=",
"True",
")",
"->",
"list",
":",
"cls",
"=",
"type",
"(",
"topic",
",",
"(",
"DynamicObject",
",",
")",
",",
"{",
"}",
")",
"results",
"=",
"[",
"cls",
"(",
"*",
... | d0646a482590f5cb7bfddbd1f0870f8c4bc1df80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.