1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Centralized endpoint URL constants for the Fugle marketdata SDK.
//!
//! All production endpoints are defined here so version bumps (e.g. `v1.0`
//! → `v2.0`) are a single-line change. Internal callers (`ConnectionConfig`,
//! `RestClient`) read from this module instead of inlining literal strings.
//!
//! # Custom endpoints
//!
//! Two override paths are supported:
//!
//! - REST: chain [`RestClient::base_url`](crate::RestClient::base_url) onto
//! [`RestClient::new`](crate::RestClient::new) to point at a custom host.
//! - WebSocket: pass a custom URL directly to
//! [`ConnectionConfig::new`](crate::websocket::ConnectionConfig::new), or
//! build via [`WebSocketFactory::new`](crate::WebSocketFactory::new) and
//! chain `.base_url(...)` to point at a custom prefix. As of 0.6.0 the
//! prefix MUST include the API version segment
//! (e.g. `"wss://example.com/marketdata/v1.0"`) — the factory appends
//! only `/{stock|futopt}/streaming`. Aligns with OpenAI / Stripe / AWS
//! SDK conventions. See `MIGRATION-0.6.md` for the 0.5.x → 0.6.0 shift.
// ---- Full production endpoints (default values used by convenience constructors) ----
/// Stock market WebSocket streaming endpoint.
pub const STOCK_WS: &str = "wss://api.fugle.tw/marketdata/v1.0/stock/streaming";
/// Futures and options WebSocket streaming endpoint.
pub const FUTOPT_WS: &str = "wss://api.fugle.tw/marketdata/v1.0/futopt/streaming";
/// REST API base URL (host + version, no trailing slash).
pub const REST_BASE: &str = "https://api.fugle.tw/marketdata/v1.0";
// ---- Host roots (no version) used for staging / mock-server overrides ----
/// REST API host root (no version segment).
///
/// Combine with [`API_VERSION`] to derive a custom REST base.
pub const REST_BASE_ROOT: &str = "https://api.fugle.tw/marketdata";
/// WebSocket host root (no version segment).
///
/// Note: as of 0.6.0,
/// [`WebSocketFactory::base_url`](crate::WebSocketFactory::base_url)
/// expects the FULL prefix including [`API_VERSION`]. Pass
/// `format!("{}/{}", WS_BASE_ROOT, API_VERSION)` or — more idiomatically —
/// pass the version-included literal directly.
pub const WS_BASE_ROOT: &str = "wss://api.fugle.tw/marketdata";
/// API version segment shared by REST and WebSocket endpoints.
///
/// Bump in lockstep with [`STOCK_WS`] / [`FUTOPT_WS`] / [`REST_BASE`] when
/// the marketdata service publishes a new major version.
pub const API_VERSION: &str = "v1.0";