Module: hummingbot.core.data_type.order_expiration_entry
- Tier: 3 – Rust Migration
- Source Path:
hummingbot/core/data_type/order_expiration_entry.pyx
- C++ Source:
hummingbot/core/cpp/OrderExpirationEntry.cpp, OrderExpirationEntry.h
- Status: Migration candidate
API Surface
C++ Struct Fields (private)
| Field |
Type |
Description |
tradingPair |
std::string |
Trading pair identifier |
orderId |
std::string |
Client order ID |
timestamp |
double |
Order creation timestamp |
expiration_timestamp |
double |
Order expiration timestamp |
C++ Constructors
OrderExpirationEntry() — default constructor (all fields zeroed/empty)
OrderExpirationEntry(string tradingPair, string orderId, double timestamp, double expiration_timestamp) — parameterized constructor
OrderExpirationEntry(const OrderExpirationEntry &other) — copy constructor
OrderExpirationEntry &operator=(const OrderExpirationEntry &other) — copy assignment
C++ Methods
| Method |
Return Type |
Description |
getTradingPair() |
std::string |
Returns trading pair |
getClientOrderID() |
std::string |
Returns client order ID |
getTimestamp() |
double |
Returns creation timestamp |
getExpirationTimestamp() |
double |
Returns expiration timestamp |
operator< (friend) |
bool |
Ordering: by expiration_timestamp first, then orderId |
Python-facing API (Cython wrapper)
class OrderExpirationEntry:
def __init__(self,
trading_pair: str,
order_id: str,
timestamp: float,
expiration_ts: float): ...
@property
def trading_pair(self) -> str: ...
@property
def order_id(self) -> str: ...
@property
def timestamp(self) -> float: ...
@property
def expiration_timestamp(self) -> float: ...
def __repr__(self) -> str: ...
@classmethod
def to_pandas(cls, order_expiration_entries: List[OrderExpirationEntry]) -> pd.DataFrame: ...
Cython internal helper (cdef, not public Python)
cdef OrderExpirationEntry c_create_order_expiration_from_cpp_order_expiration(
const CPPOrderExpirationEntry cpp_order_expiration_entry
)
to_pandas DataFrame columns
["trading_pair", "order_id", "timestamp", "expiration", "expiration_time"]
Note: .pyx exposes expiration_timestamp as a property, but to_pandas uses columns named expiration and expiration_time — these reference fields expiration_entry.expiration and expiration_entry.expiration_time which do not exist on the public API (likely a latent bug in the original).
Rust Migration Rationale
This is the smallest self-contained C++ module in hummingbot — a single struct wrapping order expiration data. It has no dependencies on other C++ modules (unlike OrderBookEntry or LimitOrder). This makes it the ideal first migration target to validate the full Rust pipeline end-to-end:
- C++ struct → Rust struct with PyO3 bindings
- Python wrapper with fallback pattern
- Integration into hummingbot via rust_accelerators
Dependencies
- None (self-contained C++ struct)
- Used by:
paper_trade_exchange.pxd (via cimport — type annotation only)
Migration Scope
- Replace
OrderExpirationEntry.cpp + .h with Rust PyO3 implementation
- Replace
order_expiration_entry.pyx with Python wrapper importing from rust_accelerators
- Maintain identical Python-facing API
- Implement
__lt__ for ordering (expiration_timestamp first, then order_id) to match C++ operator<
- Clarify/fix
to_pandas column naming (expiration / expiration_time vs expiration_timestamp)
This issue was created to validate the cython-framework → rust-accelerators migration pipeline.
Module:
hummingbot.core.data_type.order_expiration_entryhummingbot/core/data_type/order_expiration_entry.pyxhummingbot/core/cpp/OrderExpirationEntry.cpp,OrderExpirationEntry.hAPI Surface
C++ Struct Fields (private)
tradingPairstd::stringorderIdstd::stringtimestampdoubleexpiration_timestampdoubleC++ Constructors
OrderExpirationEntry()— default constructor (all fields zeroed/empty)OrderExpirationEntry(string tradingPair, string orderId, double timestamp, double expiration_timestamp)— parameterized constructorOrderExpirationEntry(const OrderExpirationEntry &other)— copy constructorOrderExpirationEntry &operator=(const OrderExpirationEntry &other)— copy assignmentC++ Methods
getTradingPair()std::stringgetClientOrderID()std::stringgetTimestamp()doublegetExpirationTimestamp()doubleoperator<(friend)boolexpiration_timestampfirst, thenorderIdPython-facing API (Cython wrapper)
Cython internal helper (cdef, not public Python)
cdef OrderExpirationEntry c_create_order_expiration_from_cpp_order_expiration( const CPPOrderExpirationEntry cpp_order_expiration_entry )to_pandasDataFrame columns["trading_pair", "order_id", "timestamp", "expiration", "expiration_time"]Note:
.pyxexposesexpiration_timestampas a property, butto_pandasuses columns namedexpirationandexpiration_time— these reference fieldsexpiration_entry.expirationandexpiration_entry.expiration_timewhich do not exist on the public API (likely a latent bug in the original).Rust Migration Rationale
This is the smallest self-contained C++ module in hummingbot — a single struct wrapping order expiration data. It has no dependencies on other C++ modules (unlike OrderBookEntry or LimitOrder). This makes it the ideal first migration target to validate the full Rust pipeline end-to-end:
Dependencies
paper_trade_exchange.pxd(via cimport — type annotation only)Migration Scope
OrderExpirationEntry.cpp+.hwith Rust PyO3 implementationorder_expiration_entry.pyxwith Python wrapper importing fromrust_accelerators__lt__for ordering (expiration_timestamp first, then order_id) to match C++operator<to_pandascolumn naming (expiration/expiration_timevsexpiration_timestamp)This issue was created to validate the cython-framework → rust-accelerators migration pipeline.