MCPcopy Create free account

hub / github.com/HourglassDevTeam/HourglassExchange / functions

Functions645 in github.com/HourglassDevTeam/HourglassExchange

↓ 2 callersMethodget_exchange_ts
[PART 3] - [Miscellaneous]
src/hourglass/account/mod.rs:705
↓ 2 callersFunctionget_mac_address
()
src/common/order/identification/machine_id.rs:33
↓ 2 callersMethodget_position_both_ways
(&self, instrument: &Instrument)
src/hourglass/account/account_handlers/position_handler.rs:321
↓ 2 callersMethodget_position_long_config
(&self, instrument: &Instrument)
src/hourglass/account/account_handlers/position_handler.rs:774
↓ 2 callersMethodget_position_short_config
(&self, instrument: &Instrument)
src/hourglass/account/account_handlers/position_handler.rs:783
↓ 2 callersMethodget_random_latency
从预定义的延迟值数组中随机选择一个延迟值。 该函数用于从 `selectable_latencies` 数组中随机选择一个延迟值, 用于模拟不同请求的延迟情况,增强测试或模拟的真实性。 # 返回值 返回一个随机选择的延迟值 `i64`。
src/hourglass/account/account_orders.rs:471
↓ 2 callersMethodget_union_table_names
(&self, database: &str)
src/hourglass/clickhouse_api/queries_operations.rs:128
↓ 2 callersMethodhandle_config_inheritance
FIXME 查看是否仅在 `Net` 的时候 才会继承 当且仅当 `PositionDirectionMode` 是 `Net` 的时候, 允许在处理新的trade的时候继承反向仓位的configuration.并且返回.
src/hourglass/account/account_handlers/position_handler.rs:536
↓ 2 callersMethodliquidate_position_by_trade
根据收到的爆仓MarketTrade来处理爆仓。
src/hourglass/account/account_handlers/position_handler.rs:998
↓ 2 callersFunctionlocal_timezone
()
src/hourglass_log/mod.rs:75
↓ 2 callersMethodmarket_event_tx
(self, value: UnboundedSender<MarketTrade>)
src/hourglass/mod.rs:257
↓ 2 callersMethodnot_like_clause
添加NOT LIKE条件
src/hourglass/clickhouse_api/query_builder/mod.rs:66
↓ 2 callersMethodoptimize_table
(&self, table_path: &str)
src/hourglass/clickhouse_api/queries_operations.rs:311
↓ 2 callersMethodparse_kind
(&self)
src/hourglass/clickhouse_api/datatype/clickhouse_trade_data.rs:26
↓ 2 callersMethodparse_side
将 `side` 字符串解析为 `Side` 枚举
src/hourglass/clickhouse_api/queries_operations.rs:48
↓ 2 callersMethodprocess_backtest_requestopen_with_a_simulated_latency
# 参数 - `order`: 要处理的订单请求 (`Order<RequestOpen>`)。 # 返回值 - 返回一个包含预测时间戳的待处理订单 (`Order<RequestOpen>`)。 注意 : 仅在回测场景下用这个方法!!!
src/hourglass/account/account_orders.rs:486
↓ 2 callersMethodratio
(&self)
src/dashboard/metrics/ratio.rs:44
↓ 2 callersMethodregister_exit_position
(&self, meta: &PositionMeta, side: Side, exit_margin: Option<f64>)
src/hourglass/account/account_handlers/position_handler.rs:754
↓ 2 callersMethodremove_expired_orders
(&mut self, expiration_times: &HashMap<OrderId, i64>, current_time: i64)
src/hourglass/hourglass_orderbook/mod.rs:63
↓ 2 callersMethodremove_order
(&mut self)
src/hourglass/hourglass_orderbook/mod.rs:58
↓ 2 callersMethodrotate
创建一个每给定周期轮换新文件的文件Appender
src/hourglass_log/appender/file.rs:178
↓ 2 callersMethodstart
(mut self)
src/hourglass/mod.rs:62
↓ 2 callersFunctionto_utc
(time: Time)
src/hourglass_log/mod.rs:42
↓ 2 callersMethodtrades_per_day
(&self)
src/dashboard/metrics/ratio.rs:49
↓ 2 callersMethodupdate
更新数据汇总结构体,给定一个新的数据点。 # 原理解释 当一个新的数据点被添加时,我们需要更新结构体中的计数、总和、均值以及离散度。 具体步骤如下: 1. **计数增加**:每次添加新数据点,计数器都会增加。 2. **更新总和**:将新数据点的值加入总和。 3. **更新均值**:使用 Wel
src/dashboard/summary/data.rs:44
↓ 2 callersMethodupdate_isolated_margin
更新隔离保证金
src/hourglass/account/account_handlers/position_handler.rs:1110
↓ 2 callersMethodupdate_unrealised_pnl
更新 unrealised_pnl FIXME 在更新未实现盈亏时,现在使用 self.current_size 来计算,但是在反向仓位或部分平仓的情况下,会不会有问题, FIXME 因为仓位大小已经发生变化。建议确保每次在更新未实现盈亏时,考虑实际持仓方向和剩余仓位大小。
src/common/account_positions/position_meta.rs:134
↓ 2 callersFunctionupdate_variance_accumulator
计算下一个 Welford 在线递推关系 M。
src/dashboard/welford_online.rs:55
↓ 1 callersMethodapply_trade_changes
从交易中更新余额并返回 [`AccountEvent`]
src/hourglass/account/account_handlers/balance_handler.rs:148
↓ 1 callersMethodbuild
构建 RedisVault 实例。
src/vault/redis.rs:132
↓ 1 callersMethodbuild
完成TideLog记录器的构建。 此调用会启动一个日志线程,将日志消息格式化为字符串,然后写入输出目标。
src/hourglass_log/mod.rs:601
↓ 1 callersFunctioncalculate_annual
计算年化比率。 # 参数 - `ratio_per_trade`: 每笔交易的比率。 - `trades_per_day`: 每日交易次数。 - `trading_days`: 年度内的交易天数。 # 返回 返回计算得到的年化比率。
src/dashboard/metrics/ratio.rs:193
↓ 1 callersMethodcalculate_range
计算数据集的最高值和最低值之间的范围。提供惰性计算功能。 # 原理解释 有时候你可能不会立即需要范围的值,因此可以在需要时调用此方法来计算范围。 # 返回 返回范围值,即 `high - low` 的结果。
src/dashboard/dispersion.rs:136
↓ 1 callersMethodcancel_orders_all
(&self)
src/hourglass/hourglass_client_local_mode.rs:154
↓ 1 callersMethodcancel_orders_all
(&mut self, response_tx: Sender<Result<Vec<Order<Cancelled>>, ExchangeError>>)
src/hourglass/account/mod.rs:664
↓ 1 callersMethodcheck_direction_conflict
辅助函数,用于检查仓位方向冲突
src/hourglass/account/mod.rs:384
↓ 1 callersMethodcheck_position_direction_conflict
检查给定的 `new_order_side` 是否与现有仓位方向冲突,并根据 `is_reduce_only` 标志做出相应处理。 ### 参数: - `instrument`: 订单涉及的金融工具。 - `new_order_side`: 新订单的方向(买/卖)。 - `is_reduce_on
src/hourglass/account/account_handlers/position_handler.rs:390
↓ 1 callersMethodclose_and_reverse_position
关闭并反向开仓
src/hourglass/account/account_handlers/position_handler.rs:982
↓ 1 callersFunctioncompute_sample_variance
使用贝塞尔校正(count - 1)和 Welford 在线递推关系 M 计算下一个无偏的“样本”方差。
src/dashboard/welford_online.rs:61
↓ 1 callersMethodcreate_database_if_not_exists
(&self, database: &str)
src/hourglass/clickhouse_api/queries_operations.rs:402
↓ 1 callersMethodcreate_or_update_single_level_orderbook_from_market_trade
创建或更新一个单级别的订单簿(SingleLevelOrderBook),基于传入的市场交易(MarketTrade)。 # 参数 - `trade`: 引用 `MarketTrade` 类型的交易信息,用于从中提取 `instrument` 并更新对应的订单簿。 # 实现步骤 1. 从 `tr
src/hourglass/account/account_handlers/trade_handler.rs:83
↓ 1 callersFunctioncreate_test_account_configuration
创建一个测试用的 `AccountConfig` 实例。
src/test_utils.rs:55
↓ 1 callersMethodcreate_unioned_table
(&self, database: &str, new_table_
src/hourglass/clickhouse_api/queries_operations.rs:156
↓ 1 callersMethodcreate_users_table
(&self, database: &str)
src/hourglass/clickhouse_api/queries_operations.rs:414
↓ 1 callersMethodcursor_public_trades
(&'a self, exchange: &'a str, instrument: &'a str, date: &'a str, base: &'a str, quote: &'a str)
src/hourglass/clickhouse_api/queries_operations.rs:247
↓ 1 callersMethoddeposit_multiple_coins
为多个指定的 `Token` 充值指定数量的稳定币。 如果这些 `Token` 中有已经存在于 `balances` 中的,则更新其余额;如果不存在,则创建新的 `Balance` 条目。 # 参数 `deposits` - 包含多个 `Token` 和对应充值金额的元组的集合。 # 返回值
src/hourglass/account/mod.rs:235
↓ 1 callersMethoddetermine_handling_type
(&self, trade: ClientTrade)
src/hourglass/account/account_handlers/position_handler.rs:570
↓ 1 callersMethoddetermine_matching_side
检查传入的 [`MarketTrade`] 与当前客户 [`Order<Open>`] 匹配的是买单还是卖单
src/hourglass/open_orders_book.rs:80
↓ 1 callersFunctionduration
(from: Time, to: Time)
src/hourglass_log/mod.rs:48
↓ 1 callersFunctionexpand_date_str
(input_str: &str)
src/hourglass/utils/chrono_operations.rs:84
↓ 1 callersMethodflush
(&mut self)
src/hourglass_log/appender/file.rs:259
↓ 1 callersMethodget_maker_fee_rate
(&self, instrument_kind: &InstrumentKind)
src/hourglass/account/account_config.rs:112
↓ 1 callersMethodget_taker_fee_rate
(&self, instrument_kind: &InstrumentKind)
src/hourglass/account/account_config.rs:120
↓ 1 callersMethodhandle_trade_data
处理交易数据的方法
src/hourglass/account/account_handlers/trade_handler.rs:94
↓ 1 callersMethodhash_as_u64
将 `Instrument` 转换为一个 `u64`,通过哈希
src/common/account_positions/position_id.rs:35
↓ 1 callersMethodinit
(self)
src/hourglass_log/mod.rs:303
↓ 1 callersFunctioninitial_balances
()
tests/util/mod.rs:127
↓ 1 callersMethodinitialize_tokens
初始化账户中要使用的币种,初始余额设为 0。 # 参数 `tokens` - 一个包含要初始化的 `Token` 名称的 `Vec<String>`。
src/hourglass/account/mod.rs:185
↓ 1 callersMethodinsert_into_unioned_table
(&self, database: &str, target_table_name: &str, additional_table_names: &[String], report_progress: bool)
src/hourglass/clickhouse_api/queries_operations.rs:360
↓ 1 callersMethodinsert_perpetual_pos_long
插入方法,推断 `PositionId` 并插入 `PerpetualPosition` 到 `perpetual_pos_long`
src/common/account_positions/exited_positions.rs:57
↓ 1 callersMethodinsert_perpetual_pos_short
插入方法,推断 `PositionId` 并插入 `PerpetualPosition` 到 `perpetual_pos_short`
src/common/account_positions/exited_positions.rs:65
↓ 1 callersFunctionis_port_in_use
Function to check if a port is in use
src/hourglass/mod.rs:357
↓ 1 callersMethodis_waiting_for_peak
判断是否在等待下一个权益峰值。如果新的 [`EquitySnapshot`] 高于之前的峰值,则为 `true`。 # 返回 返回 `true` 如果在等待峰值;否则返回 `false`。
src/dashboard/metrics/drawdown.rs:113
↓ 1 callersMethodlet_it_roll
发送 LetItRoll 命令的函数
src/hourglass/hourglass_client_local_mode.rs:178
↓ 1 callersMethodlisten_for_market_data
(&mut self)
src/hourglass/hourglass_client_local_mode.rs:194
↓ 1 callersFunctionload_json_market_trade
定义一个函数来加载JSON并将其转换为Vec<MarketTrade>
tests/util/trade_jason_reader.rs:7
↓ 1 callersFunctionlocal_date_from_unix
(unix_time: i64)
src/hourglass/utils/chrono_operations.rs:68
↓ 1 callersFunctionlocal_datetime_from_short_unix
定义一个函数,接受short UNIX时间戳并返回东八区精确时间
src/hourglass/utils/chrono_operations.rs:38
↓ 1 callersFunctionlocal_hour_from_unix
定义一个函数,接受UNIX时间戳并返回东八区小时数
src/hourglass/utils/chrono_operations.rs:48
↓ 1 callersFunctionlocal_minute_from_unix
(unix_time: i64)
src/hourglass/utils/chrono_operations.rs:57
↓ 1 callersMethodmatch_asks
(&mut self, market_trade: &MarketTrade, fees_percent: f64, counter: &AtomicI64)
src/hourglass/open_orders_book.rs:161
↓ 1 callersMethodmatch_bids
(&mut self, market_trade: &MarketTrade, fees_percent: f64, counter: &AtomicI64)
src/hourglass/open_orders_book.rs:106
↓ 1 callersMethodmax_log_level
设置最大日志级别 比此级别更详细的日志将不会被发送到日志线程。
src/hourglass_log/mod.rs:551
↓ 1 callersFunctionmock_up_strategy
(trade: &MarketTrade)
examples/backtest_example.rs:381
↓ 1 callersMethodmsg
(&self, record: &Record)
src/hourglass_log/mod.rs:233
↓ 1 callersFunctionorder_limit_cancelled
(instrument: I, cid: ClientOrderId, side: Side, id: Id)
tests/util/mod.rs:187
↓ 1 callersFunctionorder_parser
(client: &HourglassClient, trade: &MarketTrade, order_ids: &mut Vec<OrderId>)
examples/backtest_example.rs:333
↓ 1 callersFunctionorder_request_limit
创建限价订单请求
tests/util/mod.rs:139
↓ 1 callersMethodparse_base
(&self)
src/hourglass/clickhouse_api/datatype/clickhouse_trade_data.rs:95
↓ 1 callersMethodparse_quote
(&self)
src/hourglass/clickhouse_api/datatype/clickhouse_trade_data.rs:127
↓ 1 callersMethodpartial_close_position
部分平仓 FIXME 要检查一下逻辑是否正确
src/hourglass/account/account_handlers/position_handler.rs:1040
↓ 1 callersMethodpartial_cmp
(&self, other: &Self)
src/hourglass/clickhouse_api/queries_operations.rs:71
↓ 1 callersMethodpartial_cmp
实现 `PartialOrd` trait,使用 `cmp` 方法进行比较。 # 参数 - `other`: 要比较的另一个 `Order<Open>` 实例。 # 返回值 返回 `Option<Ordering>`,指示当前实例相对于 `other` 是小于、等于还是大于。
src/common/order/states/open.rs:58
↓ 1 callersMethodpreconfigure_position
Before a `Position` is opened, ideally it is advised to pre-configure a position by setting control fields. Ensures that the `leverage` the pre-config
src/hourglass/account/account_handlers/position_handler.rs:126
↓ 1 callersMethodprocess_trades
(&mut self, client_trades: Vec<ClientTrade>)
src/hourglass/account/account_handlers/trade_handler.rs:266
↓ 1 callersMethodquery_unioned_trade_table
(&self, exchange: &str, instrument: &str, channel: &str, date: &str)
src/hourglass/clickhouse_api/queries_operations.rs:237
↓ 1 callersMethodremove_future_position
(&self, instrument: Instrument, side: Side)
src/hourglass/account/account_handlers/position_handler.rs:708
↓ 1 callersMethodremove_leveraged_token_position
(&self, instrument: Instrument, side: Side)
src/hourglass/account/account_handlers/position_handler.rs:722
↓ 1 callersMethodremove_option_position
(&self, instrument: Instrument, side: Side)
src/hourglass/account/account_handlers/position_handler.rs:736
↓ 1 callersMethodremove_perpetual_position
(&self, instrument: Instrument, side: Side)
src/hourglass/account/account_handlers/position_handler.rs:694
↓ 1 callersMethodretrieve_all_trades
(&self, exchange: &str, instrument: &str, date: &str, base: &str, quote: &str)
src/hourglass/clickhouse_api/queries_operations.rs:207
↓ 1 callersMethodroot
配置默认的日志输出目标。 如果省略此方法,日志将输出到标准错误输出(stderr)。
src/hourglass_log/mod.rs:542
↓ 1 callersFunctionroutes
创建一个 warp 服务器的路由 定义一个 Warp 路由,该路由使用了 `warp::path("hello")` 过滤器, 并且包含一个自动关闭服务器的机制。当 `/hello` 路由被访问时, 服务器会响应一段文本,并通过 `shutdown_tx` 发送关闭信号, 从而优雅关闭服务器。
examples/warp_hyper_respond_and_shutdown.rs:13
↓ 1 callersMethodrun_online
网络运行 [`HourglassExchange`],并从网络接收事件
src/hourglass/mod.rs:174
↓ 1 callersFunctionrun_sample_exchange
Initializes and runs a sample exchange with predefined settings and a test order.
tests/util/mod.rs:44
↓ 1 callersFunctionsetup_clickhouse_client
()
src/hourglass/clickhouse_api/queries_operations.rs:448
↓ 1 callersFunctiontest_11_cancel_all_orders
(client: &HourglassClient, test_6_ids_1: Ids, event_hourglass_rx: &mut mpsc::UnboundedReceiver<AccountEvent>)
tests/test_set.rs:412
↓ 1 callersFunctiontest_1_fetch_initial_orders_and_check_empty
1. Fetch initial OpenOrders when we have no open Orders.
tests/test_set.rs:124
↓ 1 callersFunctiontest_2_fetch_balances_and_check_same_as_initial
(client: &HourglassClient)
tests/test_set.rs:150
↓ 1 callersFunctiontest_3_open_limit_buy_order
(client: &HourglassClient, test_3_ids: Ids, event_hourglass_rx: &mut mpsc::UnboundedReceiver<AccountEvent>)
tests/test_set.rs:170
← previousnext →101–200 of 645, ranked by callers