18df96872b
* Add closed-bar rate helpers and bump version to 0.6.0. Expose drop_forming_rate_bar and multi-account collectors so downstream apps no longer need count+1 fetches and manual bar trimming. Co-authored-by: Cursor <cursoragent@cursor.com> * Bump pygments to 2.20.0 to fix CVE-2026-4539 ReDoS advisory. Co-authored-by: Cursor <cursoragent@cursor.com> * Address PR review feedback on closed-bar rate collection. Validate count and start_pos before MT5 fetches, avoid redundant frame copies, clarify empty-series errors, and expand test coverage. Co-authored-by: Cursor <cursoragent@cursor.com> * Include symbol and timeframe in empty closed-rate error messages. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
144 lines
3.3 KiB
Python
144 lines
3.3 KiB
Python
"""mt5cli: Command-line tool and SDK for MetaTrader 5."""
|
|
|
|
from importlib.metadata import version
|
|
|
|
from .history import (
|
|
RateTarget,
|
|
build_rate_targets,
|
|
build_rate_view_name,
|
|
drop_forming_rate_bar,
|
|
load_rate_data,
|
|
load_rate_data_from_connection,
|
|
load_rate_series_by_granularity,
|
|
load_rate_series_from_sqlite,
|
|
resolve_history_datasets,
|
|
resolve_history_tick_flags,
|
|
resolve_history_timeframes,
|
|
resolve_rate_tables,
|
|
resolve_rate_view_name,
|
|
resolve_rate_view_names,
|
|
)
|
|
from .sdk import (
|
|
AccountSpec,
|
|
Mt5CliClient,
|
|
ThrottledHistoryUpdater,
|
|
account_info,
|
|
build_config,
|
|
collect_history,
|
|
collect_latest_closed_rates_by_granularity,
|
|
collect_latest_closed_rates_for_accounts,
|
|
collect_latest_rates,
|
|
collect_latest_rates_for_accounts,
|
|
collect_latest_rates_for_accounts_with_retries,
|
|
copy_rates_from,
|
|
copy_rates_from_pos,
|
|
copy_rates_range,
|
|
copy_ticks_from,
|
|
copy_ticks_range,
|
|
history_deals,
|
|
history_orders,
|
|
last_error,
|
|
latest_rates,
|
|
market_book,
|
|
minimum_margins,
|
|
mt5_session,
|
|
mt5_summary,
|
|
mt5_summary_as_df,
|
|
orders,
|
|
positions,
|
|
recent_history_deals,
|
|
recent_ticks,
|
|
resolve_account_spec,
|
|
resolve_account_specs,
|
|
substitute_env_placeholders,
|
|
symbol_info,
|
|
symbol_info_tick,
|
|
symbols,
|
|
terminal_info,
|
|
update_history,
|
|
update_history_with_config,
|
|
)
|
|
from .sdk import (
|
|
version as mt5_version,
|
|
)
|
|
from .utils import (
|
|
TICK_FLAG_MAP,
|
|
TIMEFRAME_MAP,
|
|
Dataset,
|
|
IfExists,
|
|
detect_format,
|
|
export_dataframe,
|
|
export_dataframe_to_sqlite,
|
|
parse_datetime,
|
|
parse_tick_flags,
|
|
parse_timeframe,
|
|
)
|
|
|
|
__version__ = version(__package__) if __package__ else None
|
|
|
|
__all__ = [
|
|
"TICK_FLAG_MAP",
|
|
"TIMEFRAME_MAP",
|
|
"AccountSpec",
|
|
"Dataset",
|
|
"IfExists",
|
|
"Mt5CliClient",
|
|
"RateTarget",
|
|
"ThrottledHistoryUpdater",
|
|
"account_info",
|
|
"build_config",
|
|
"build_rate_targets",
|
|
"build_rate_view_name",
|
|
"collect_history",
|
|
"collect_latest_closed_rates_by_granularity",
|
|
"collect_latest_closed_rates_for_accounts",
|
|
"collect_latest_rates",
|
|
"collect_latest_rates_for_accounts",
|
|
"collect_latest_rates_for_accounts_with_retries",
|
|
"copy_rates_from",
|
|
"copy_rates_from_pos",
|
|
"copy_rates_range",
|
|
"copy_ticks_from",
|
|
"copy_ticks_range",
|
|
"detect_format",
|
|
"drop_forming_rate_bar",
|
|
"export_dataframe",
|
|
"export_dataframe_to_sqlite",
|
|
"history_deals",
|
|
"history_orders",
|
|
"last_error",
|
|
"latest_rates",
|
|
"load_rate_data",
|
|
"load_rate_data_from_connection",
|
|
"load_rate_series_by_granularity",
|
|
"load_rate_series_from_sqlite",
|
|
"market_book",
|
|
"minimum_margins",
|
|
"mt5_session",
|
|
"mt5_summary",
|
|
"mt5_summary_as_df",
|
|
"mt5_version",
|
|
"orders",
|
|
"parse_datetime",
|
|
"parse_tick_flags",
|
|
"parse_timeframe",
|
|
"positions",
|
|
"recent_history_deals",
|
|
"recent_ticks",
|
|
"resolve_account_spec",
|
|
"resolve_account_specs",
|
|
"resolve_history_datasets",
|
|
"resolve_history_tick_flags",
|
|
"resolve_history_timeframes",
|
|
"resolve_rate_tables",
|
|
"resolve_rate_view_name",
|
|
"resolve_rate_view_names",
|
|
"substitute_env_placeholders",
|
|
"symbol_info",
|
|
"symbol_info_tick",
|
|
"symbols",
|
|
"terminal_info",
|
|
"update_history",
|
|
"update_history_with_config",
|
|
]
|