QuoteContext
struct QuoteContext
Quote context
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
loop {
let quote = ctx.receiver.recv()!;
}
new
pub fn new(config: Config): QuoteContext throws OpenApiError
[src]
pub fn new(config: Config): QuoteContext throws OpenApiError {
let inner = try _QuoteContext.new(config as _Config);
let receiver = channel::<PushEvent>();
spawn {
do {
loop {
try receiver.send(PushEvent.new(inner.receiver.recv()));
}
}
}
return QuoteContext { inner, receiver };
}
Create a QuoteContext
new
pub fn new(config: Config): QuoteContext throws OpenApiError
[src]
pub fn new(config: Config): QuoteContext throws OpenApiError {
let inner = try _QuoteContext.new(config as _Config);
let receiver = channel::<PushEvent>();
spawn {
do {
loop {
try receiver.send(PushEvent.new(inner.receiver.recv()));
}
}
}
return QuoteContext { inner, receiver };
}
Create a QuoteContext
Create a QuoteContext
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
[src]
pub fn member_id(self): int {
return self.inner.member_id();
}
Returns the member ID
[src]
pub fn member_id(self): int {
return self.inner.member_id();
}
Returns the member ID
Returns the member ID
quote_level
pub fn quote_level(self): string
[src]
pub fn quote_level(self): string {
return self.inner.quote_level();
}
Returns the quote level
quote_level
pub fn quote_level(self): string
[src]
pub fn quote_level(self): string {
return self.inner.quote_level();
}
Returns the quote level
Returns the quote level
subscribe
pub fn subscribe(self, symbols: [string], sub_types: int, is_first_push: bool) throws OpenApiError
[src]
pub fn subscribe(self, symbols: [string], sub_types: int, is_first_push: bool) throws OpenApiError {
try self.inner.subscribe(symbols, sub_types, is_first_push);
}
Subscribe
subscribe
pub fn subscribe(self, symbols: [string], sub_types: int, is_first_push: bool) throws OpenApiError
[src]
pub fn subscribe(self, symbols: [string], sub_types: int, is_first_push: bool) throws OpenApiError {
try self.inner.subscribe(symbols, sub_types, is_first_push);
}
Subscribe
Subscribe
See also: https://open.longportapp.com/en/docs/quote/subscribe/subscribe
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
unsubscribe
pub fn unsubscribe(self, symbols: [string], sub_types: int) throws OpenApiError
[src]
pub fn unsubscribe(self, symbols: [string], sub_types: int) throws OpenApiError {
try self.inner.unsubscribe(symbols, sub_types);
}
Unsubscribe
unsubscribe
pub fn unsubscribe(self, symbols: [string], sub_types: int) throws OpenApiError
[src]
pub fn unsubscribe(self, symbols: [string], sub_types: int) throws OpenApiError {
try self.inner.unsubscribe(symbols, sub_types);
}
Unsubscribe
Unsubscribe
See also: https://open.longportapp.com/en/docs/quote/subscribe/unsubscribe
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "MSFT.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
try! ctx.unsubscribe(
["MSFT.US"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
);
subscribe_candlesticks
pub fn subscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError
[src]
pub fn subscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError {
try self.inner.subscribe_candlesticks(symbol, period as int);
}
Subscribe security candlesticks
subscribe_candlesticks
pub fn subscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError
[src]
pub fn subscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError {
try self.inner.subscribe_candlesticks(symbol, period as int);
}
Subscribe security candlesticks
Subscribe security candlesticks
Examples
use longport.Config;
use longport.quote.{self, Period, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe_candlesticks("MMM.US", Period.OneMinute);
unsubscribe_candlesticks
pub fn unsubscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError
[src]
pub fn unsubscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError {
try self.inner.unsubscribe_candlesticks(symbol, period as int);
}
Unsubscribe security candlesticks
unsubscribe_candlesticks
pub fn unsubscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError
[src]
pub fn unsubscribe_candlesticks(self, symbol: string, period: Period) throws OpenApiError {
try self.inner.unsubscribe_candlesticks(symbol, period as int);
}
Unsubscribe security candlesticks
Unsubscribe security candlesticks
Examples
use longport.Config;
use longport.quote.{self, Period, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe_candlesticks("9988.HK", Period.FiveMinute);
try! ctx.unsubscribe_candlesticks("9988.HK", Period.FiveMinute);
subscriptions
pub fn subscriptions(self): [Subscription] throws OpenApiError
[src]
pub fn subscriptions(self): [Subscription] throws OpenApiError {
let _items = try self.inner.subscriptions();
let items: [Subscription] = [];
for (let _item in _items) {
items.push(Subscription.new(_item));
}
return items;
}
Get subscription information
subscriptions
pub fn subscriptions(self): [Subscription] throws OpenApiError
[src]
pub fn subscriptions(self): [Subscription] throws OpenApiError {
let _items = try self.inner.subscriptions();
let items: [Subscription] = [];
for (let _item in _items) {
items.push(Subscription.new(_item));
}
return items;
}
Get subscription information
Get subscription information
Examples
use longport.Config;
use longport.quote.{self, Period, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
try! ctx.subscribe_candlesticks("MMM.US", Period.OneMinute);
let subscriptions = try! ctx.subscriptions();
static_info
pub fn static_info(self, symbols: [string]): [SecurityStaticInfo] throws OpenApiError
[src]
pub fn static_info(self, symbols: [string]): [SecurityStaticInfo] throws OpenApiError {
let _items = try self.inner.static_info(symbols);
let items: [SecurityStaticInfo] = [];
for (let _item in _items) {
items.push(SecurityStaticInfo.new(_item));
}
return items;
}
Get basic information of securities
static_info
pub fn static_info(self, symbols: [string]): [SecurityStaticInfo] throws OpenApiError
[src]
pub fn static_info(self, symbols: [string]): [SecurityStaticInfo] throws OpenApiError {
let _items = try self.inner.static_info(symbols);
let items: [SecurityStaticInfo] = [];
for (let _item in _items) {
items.push(SecurityStaticInfo.new(_item));
}
return items;
}
Get basic information of securities
Get basic information of securities
See also: https://open.longportapp.com/en/docs/quote/pull/static
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let infos = try! ctx.static_info(["MMM.US", "MSFT.US", "PEP.US"]);
quote
pub fn quote(self, symbols: [string]): [SecurityQuote] throws OpenApiError
[src]
pub fn quote(self, symbols: [string]): [SecurityQuote] throws OpenApiError {
let _items = try self.inner.quote(symbols);
let items: [SecurityQuote] = [];
for (let _item in _items) {
items.push(SecurityQuote.new(_item));
}
return items;
}
Get quote of securities
quote
pub fn quote(self, symbols: [string]): [SecurityQuote] throws OpenApiError
[src]
pub fn quote(self, symbols: [string]): [SecurityQuote] throws OpenApiError {
let _items = try self.inner.quote(symbols);
let items: [SecurityQuote] = [];
for (let _item in _items) {
items.push(SecurityQuote.new(_item));
}
return items;
}
Get quote of securities
Get quote of securities
See also: https://open.longportapp.com/en/docs/quote/pull/quote
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let quotes = try! ctx.quote(["MMM.US", "MSFT.US", "PEP.US"]);
option_quote
pub fn option_quote(self, symbols: [string]): [OptionQuote] throws OpenApiError
[src]
pub fn option_quote(self, symbols: [string]): [OptionQuote] throws OpenApiError {
let _items = try self.inner.option_quote(symbols);
let items: [OptionQuote] = [];
for (let _item in _items) {
items.push(OptionQuote.new(_item));
}
return items;
}
Get quote of option
option_quote
pub fn option_quote(self, symbols: [string]): [OptionQuote] throws OpenApiError
[src]
pub fn option_quote(self, symbols: [string]): [OptionQuote] throws OpenApiError {
let _items = try self.inner.option_quote(symbols);
let items: [OptionQuote] = [];
for (let _item in _items) {
items.push(OptionQuote.new(_item));
}
return items;
}
Get quote of option
Get quote of option
See also: https://open.longportapp.com/en/docs/quote/pull/option-quote
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let quotes = try! ctx.option_quote(["AAPL230317P160000"]);
warrant_quote
pub fn warrant_quote(self, symbols: [string]): [WarrantQuote] throws OpenApiError
[src]
pub fn warrant_quote(self, symbols: [string]): [WarrantQuote] throws OpenApiError {
let _items = try self.inner.warrant_quote(symbols);
let items: [WarrantQuote] = [];
for (let _item in _items) {
items.push(WarrantQuote.new(_item));
}
return items;
}
Get quote of warrant securities
warrant_quote
pub fn warrant_quote(self, symbols: [string]): [WarrantQuote] throws OpenApiError
[src]
pub fn warrant_quote(self, symbols: [string]): [WarrantQuote] throws OpenApiError {
let _items = try self.inner.warrant_quote(symbols);
let items: [WarrantQuote] = [];
for (let _item in _items) {
items.push(WarrantQuote.new(_item));
}
return items;
}
Get quote of warrant securities
Get quote of warrant securities
See also: https://open.longportapp.com/en/docs/quote/pull/warrant-quote
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let quotes = try! ctx.warrant_quote(["21125.HK"]);
depth
pub fn depth(self, symbol: string): SecurityDepth throws OpenApiError
[src]
pub fn depth(self, symbol: string): SecurityDepth throws OpenApiError {
return SecurityDepth.new(try self.inner.depth(symbol));
}
Get security depth
depth
pub fn depth(self, symbol: string): SecurityDepth throws OpenApiError
[src]
pub fn depth(self, symbol: string): SecurityDepth throws OpenApiError {
return SecurityDepth.new(try self.inner.depth(symbol));
}
Get security depth
Get security depth
See also: https://open.longportapp.com/en/docs/quote/pull/depth
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let depth = try! ctx.depth("700.HK");
brokers
pub fn brokers(self, symbol: string): SecurityBrokers throws OpenApiError
[src]
pub fn brokers(self, symbol: string): SecurityBrokers throws OpenApiError {
return SecurityBrokers.new(try self.inner.brokers(symbol));
}
Get security brokers
brokers
pub fn brokers(self, symbol: string): SecurityBrokers throws OpenApiError
[src]
pub fn brokers(self, symbol: string): SecurityBrokers throws OpenApiError {
return SecurityBrokers.new(try self.inner.brokers(symbol));
}
Get security brokers
Get security brokers
See also: https://open.longportapp.com/en/docs/quote/pull/brokers
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let brokers = try! ctx.brokers("MMM.US");
participants
pub fn participants(self): [ParticipantInfo] throws OpenApiError
[src]
pub fn participants(self): [ParticipantInfo] throws OpenApiError {
let _items = try self.inner.participants();
let items: [ParticipantInfo] = [];
for (let _item in _items) {
items.push(ParticipantInfo.new(_item));
}
return items;
}
Get participants
participants
pub fn participants(self): [ParticipantInfo] throws OpenApiError
[src]
pub fn participants(self): [ParticipantInfo] throws OpenApiError {
let _items = try self.inner.participants();
let items: [ParticipantInfo] = [];
for (let _item in _items) {
items.push(ParticipantInfo.new(_item));
}
return items;
}
Get participants
Get participants
See also: https://open.longportapp.com/en/docs/quote/pull/broker-ids
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let participants = try! ctx.participants();
trades
pub fn trades(self, symbol: string, count: int): [Trade] throws OpenApiError
[src]
pub fn trades(self, symbol: string, count: int): [Trade] throws OpenApiError {
let _items = try self.inner.trades(symbol, count);
let items: [Trade] = [];
for (let _item in _items) {
items.push(Trade.new(_item));
}
return items;
}
Get security trades
trades
pub fn trades(self, symbol: string, count: int): [Trade] throws OpenApiError
[src]
pub fn trades(self, symbol: string, count: int): [Trade] throws OpenApiError {
let _items = try self.inner.trades(symbol, count);
let items: [Trade] = [];
for (let _item in _items) {
items.push(Trade.new(_item));
}
return items;
}
Get security trades
Get security trades
See also: https://open.longportapp.com/en/docs/quote/pull/trade
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let trades = try! ctx.trades("700.HK", 10);
intraday
pub fn intraday(self, symbol: string): [IntradayLine] throws OpenApiError
[src]
pub fn intraday(self, symbol: string): [IntradayLine] throws OpenApiError {
let _items = try self.inner.intraday(symbol);
let items: [IntradayLine] = [];
for (let _item in _items) {
items.push(IntradayLine.new(_item));
}
return items;
}
Get security intraday lines
intraday
pub fn intraday(self, symbol: string): [IntradayLine] throws OpenApiError
[src]
pub fn intraday(self, symbol: string): [IntradayLine] throws OpenApiError {
let _items = try self.inner.intraday(symbol);
let items: [IntradayLine] = [];
for (let _item in _items) {
items.push(IntradayLine.new(_item));
}
return items;
}
Get security intraday lines
Get security intraday lines
See also: https://open.longportapp.com/en/docs/quote/pull/intraday
Examples
use longport.Config;
use longport.quote.QuoteContext;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let intraday_lines = try! ctx.intraday("700.HK");
candlesticks
pub fn candlesticks(self, symbol: string, period: Period, count: int, adjust_type: AdjustType): [Candlestick] throws OpenApiError
[src]
pub fn candlesticks(
self, symbol: string, period: Period, count: int, adjust_type: AdjustType
): [Candlestick] throws OpenApiError {
let _items = try self.inner.candlesticks(symbol, period as int, count, adjust_type as int);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get security candlesticks
candlesticks
pub fn candlesticks(self, symbol: string, period: Period, count: int, adjust_type: AdjustType): [Candlestick] throws OpenApiError
[src]
pub fn candlesticks(
self, symbol: string, period: Period, count: int, adjust_type: AdjustType
): [Candlestick] throws OpenApiError {
let _items = try self.inner.candlesticks(symbol, period as int, count, adjust_type as int);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get security candlesticks
Get security candlesticks
See also: https://open.longportapp.com/en/docs/quote/pull/candlestick
Examples
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let candlesticks = try! ctx.candlesticks("700.HK", Period.Day, 10, AdjustType.NoAdjust);
history_candlesticks_by_offset
pub fn history_candlesticks_by_offset(self, symbol: string, period: Period, adjust_type: AdjustType, forward: bool, time: DateTime, count: int): [Candlestick] throws OpenApiError
[src]
pub fn history_candlesticks_by_offset(
self,
symbol: string,
period: Period,
adjust_type: AdjustType,
forward: bool,
time: DateTime,
count: int
): [Candlestick] throws OpenApiError {
let _items = try self
.inner
.history_candlesticks_by_offset(
symbol,
period as int,
adjust_type as int,
forward,
time,
count
);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get security history candlesticks by offset
history_candlesticks_by_offset
pub fn history_candlesticks_by_offset(self, symbol: string, period: Period, adjust_type: AdjustType, forward: bool, time: DateTime, count: int): [Candlestick] throws OpenApiError
[src]
pub fn history_candlesticks_by_offset(
self,
symbol: string,
period: Period,
adjust_type: AdjustType,
forward: bool,
time: DateTime,
count: int
): [Candlestick] throws OpenApiError {
let _items = try self
.inner
.history_candlesticks_by_offset(
symbol,
period as int,
adjust_type as int,
forward,
time,
count
);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get security history candlesticks by offset
Get security history candlesticks by offset
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let history_candlesticks = try! ctx.history_candlesticks_by_offset(
"700.HK",
Period.Day,
AdjustType.NoAdjust,
false,
try! DateTime.parse("2024-01-01 00:00:00.000 +08:00"),
10
);
history_candlesticks_by_date
pub fn history_candlesticks_by_date(self, symbol: string, period: Period, adjust_type: AdjustType, start: DateTime? = nil, end: DateTime? = nil): [Candlestick] throws OpenApiError
[src]
pub fn history_candlesticks_by_date(
self,
symbol: string,
period: Period,
adjust_type: AdjustType,
start: DateTime? = nil,
end: DateTime? = nil
): [Candlestick] throws OpenApiError {
let _items = try self
.inner
.history_candlesticks_by_date(symbol, period as int, adjust_type as int, start:, end:);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get security history candlesticks by date
history_candlesticks_by_date
pub fn history_candlesticks_by_date(self, symbol: string, period: Period, adjust_type: AdjustType, start: DateTime? = nil, end: DateTime? = nil): [Candlestick] throws OpenApiError
[src]
pub fn history_candlesticks_by_date(
self,
symbol: string,
period: Period,
adjust_type: AdjustType,
start: DateTime? = nil,
end: DateTime? = nil
): [Candlestick] throws OpenApiError {
let _items = try self
.inner
.history_candlesticks_by_date(symbol, period as int, adjust_type as int, start:, end:);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get security history candlesticks by date
Get security history candlesticks by date
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let history_candlesticks_by_date = try! ctx.history_candlesticks_by_date(
"700.HK",
Period.Day,
AdjustType.NoAdjust,
start: try! DateTime.parse("2024-04-01 00:00:00.000 +08:00")
);
option_chain_expiry_date_list
pub fn option_chain_expiry_date_list(self, symbol: string): [DateTime] throws OpenApiError
[src]
pub fn option_chain_expiry_date_list(self, symbol: string): [DateTime] throws OpenApiError {
return try self.inner.option_chain_expiry_date_list(symbol);
}
Get option chain expiry date list
option_chain_expiry_date_list
pub fn option_chain_expiry_date_list(self, symbol: string): [DateTime] throws OpenApiError
[src]
pub fn option_chain_expiry_date_list(self, symbol: string): [DateTime] throws OpenApiError {
return try self.inner.option_chain_expiry_date_list(symbol);
}
Get option chain expiry date list
Get option chain expiry date list
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let dates = try! ctx.option_chain_expiry_date_list("MMM.US");
option_chain_info_by_date
pub fn option_chain_info_by_date(self, symbol: string, expiry_date: DateTime): [StrikePriceInfo] throws OpenApiError
[src]
pub fn option_chain_info_by_date(
self, symbol: string, expiry_date: DateTime
): [StrikePriceInfo] throws OpenApiError {
let _items = try self.inner.option_chain_info_by_date(symbol, expiry_date);
let items: [StrikePriceInfo] = [];
for (let _item in _items) {
items.push(StrikePriceInfo.new(_item));
}
return items;
}
Get option chain info by date
option_chain_info_by_date
pub fn option_chain_info_by_date(self, symbol: string, expiry_date: DateTime): [StrikePriceInfo] throws OpenApiError
[src]
pub fn option_chain_info_by_date(
self, symbol: string, expiry_date: DateTime
): [StrikePriceInfo] throws OpenApiError {
let _items = try self.inner.option_chain_info_by_date(symbol, expiry_date);
let items: [StrikePriceInfo] = [];
for (let _item in _items) {
items.push(StrikePriceInfo.new(_item));
}
return items;
}
Get option chain info by date
Get option chain info by date
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let infos = try! ctx.option_chain_info_by_date(
"MMM.US",
try! DateTime.parse("2024-04-30 00:00:00.000 +08:00")
);
warrant_issuers
pub fn warrant_issuers(self): [IssuerInfo] throws OpenApiError
[src]
pub fn warrant_issuers(self): [IssuerInfo] throws OpenApiError {
let _items = try self.inner.warrant_issuers();
let items: [IssuerInfo] = [];
for (let _item in _items) {
items.push(IssuerInfo.new(_item));
}
return items;
}
Get warrant issuers
warrant_issuers
pub fn warrant_issuers(self): [IssuerInfo] throws OpenApiError
[src]
pub fn warrant_issuers(self): [IssuerInfo] throws OpenApiError {
let _items = try self.inner.warrant_issuers();
let items: [IssuerInfo] = [];
for (let _item in _items) {
items.push(IssuerInfo.new(_item));
}
return items;
}
Get warrant issuers
Get warrant issuers
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let warrant_issuers = try! ctx.warrant_issuers();
warrant_list
pub fn warrant_list(self, symbol: string, sort_by: WarrantSortBy, sort_order: SortOrderType, incoming_warrant_type: [WarrantType]? = nil, issuer: [int]? = nil, incoming_expiry_date: [FilterWarrantExpiryDate]? = nil, incoming_price_type: [FilterWarrantInOutBoundsType]? = nil, incoming_status: [WarrantStatus]? = nil): [WarrantInfo] throws OpenApiError
[src]
pub fn warrant_list(
self,
symbol: string,
sort_by: WarrantSortBy,
sort_order: SortOrderType,
incoming_warrant_type: [WarrantType]? = nil,
issuer: [int]? = nil,
incoming_expiry_date: [FilterWarrantExpiryDate]? = nil,
incoming_price_type: [FilterWarrantInOutBoundsType]? = nil,
incoming_status: [WarrantStatus]? = nil
): [WarrantInfo] throws OpenApiError {
let warrant_type: [int]? = nil;
if (incoming_warrant_type != nil) {
warrant_type = [];
for (let item in incoming_warrant_type!) {
warrant_type?.push(item as int);
}
}
let expiry_date: [int]? = nil;
if (incoming_expiry_date != nil) {
expiry_date = [];
for (let item in incoming_expiry_date!) {
expiry_date?.push(item as int);
}
}
let price_type: [int]? = nil;
if (incoming_price_type != nil) {
price_type = [];
for (let item in incoming_price_type!) {
price_type?.push(item as int);
}
}
let status: [int]? = nil;
if (incoming_status != nil) {
status = [];
for (let item in incoming_status!) {
status?.push(item as int);
}
}
let _items = try self
.inner
.warrant_list(
symbol,
sort_by as int,
sort_order as int,
warrant_type:,
issuer:,
expiry_date:,
price_type:,
status:
);
let items: [WarrantInfo] = [];
for (let _item in _items) {
items.push(WarrantInfo.new(_item));
}
return items;
}
Query warrant list
warrant_list
pub fn warrant_list(self, symbol: string, sort_by: WarrantSortBy, sort_order: SortOrderType, incoming_warrant_type: [WarrantType]? = nil, issuer: [int]? = nil, incoming_expiry_date: [FilterWarrantExpiryDate]? = nil, incoming_price_type: [FilterWarrantInOutBoundsType]? = nil, incoming_status: [WarrantStatus]? = nil): [WarrantInfo] throws OpenApiError
[src]
pub fn warrant_list(
self,
symbol: string,
sort_by: WarrantSortBy,
sort_order: SortOrderType,
incoming_warrant_type: [WarrantType]? = nil,
issuer: [int]? = nil,
incoming_expiry_date: [FilterWarrantExpiryDate]? = nil,
incoming_price_type: [FilterWarrantInOutBoundsType]? = nil,
incoming_status: [WarrantStatus]? = nil
): [WarrantInfo] throws OpenApiError {
let warrant_type: [int]? = nil;
if (incoming_warrant_type != nil) {
warrant_type = [];
for (let item in incoming_warrant_type!) {
warrant_type?.push(item as int);
}
}
let expiry_date: [int]? = nil;
if (incoming_expiry_date != nil) {
expiry_date = [];
for (let item in incoming_expiry_date!) {
expiry_date?.push(item as int);
}
}
let price_type: [int]? = nil;
if (incoming_price_type != nil) {
price_type = [];
for (let item in incoming_price_type!) {
price_type?.push(item as int);
}
}
let status: [int]? = nil;
if (incoming_status != nil) {
status = [];
for (let item in incoming_status!) {
status?.push(item as int);
}
}
let _items = try self
.inner
.warrant_list(
symbol,
sort_by as int,
sort_order as int,
warrant_type:,
issuer:,
expiry_date:,
price_type:,
status:
);
let items: [WarrantInfo] = [];
for (let _item in _items) {
items.push(WarrantInfo.new(_item));
}
return items;
}
Query warrant list
Query warrant list
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext, WarrantSortBy, SortOrderType};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let warrants = try! ctx.warrant_list("700.HK", WarrantSortBy.LastDone, SortOrderType.Ascending);
trading_session
pub fn trading_session(self): [MarketTradingSession] throws OpenApiError
[src]
pub fn trading_session(self): [MarketTradingSession] throws OpenApiError {
let _items = try self.inner.trading_session();
let items: [MarketTradingSession] = [];
for (let _item in _items) {
items.push(MarketTradingSession.new(_item));
}
return items;
}
Get trading session of the day
trading_session
pub fn trading_session(self): [MarketTradingSession] throws OpenApiError
[src]
pub fn trading_session(self): [MarketTradingSession] throws OpenApiError {
let _items = try self.inner.trading_session();
let items: [MarketTradingSession] = [];
for (let _item in _items) {
items.push(MarketTradingSession.new(_item));
}
return items;
}
Get trading session of the day
Get trading session of the day
See also: https://open.longportapp.com/en/docs/quote/pull/trade-session
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let items = try! ctx.trading_session();
trading_days
pub fn trading_days(self, market: Market, begin: DateTime, end: DateTime): MarketTradingDays throws OpenApiError
[src]
pub fn trading_days(
self, market: Market, begin: DateTime, end: DateTime
): MarketTradingDays throws OpenApiError {
return MarketTradingDays.new(try self.inner.trading_days(market as int, begin, end));
}
Get market trading days
trading_days
pub fn trading_days(self, market: Market, begin: DateTime, end: DateTime): MarketTradingDays throws OpenApiError
[src]
pub fn trading_days(
self, market: Market, begin: DateTime, end: DateTime
): MarketTradingDays throws OpenApiError {
return MarketTradingDays.new(try self.inner.trading_days(market as int, begin, end));
}
Get market trading days
Get market trading days
The interval must be less than one month, and only the most recent year is supported.
See also: https://open.longportapp.com/en/docs/quote/pull/trade-day
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
use longport.Market;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let items = try! ctx.trading_days(
Market.HK,
try! DateTime.parse("2024-04-01 00:00:00.000 +08:00"),
try! DateTime.parse("2024-05-01 00:00:00.000 +08:00")
);
capital_flow
pub fn capital_flow(self, symbol: string): [CapitalFlowLine] throws OpenApiError
[src]
pub fn capital_flow(self, symbol: string): [CapitalFlowLine] throws OpenApiError {
let _items = try self.inner.capital_flow(symbol);
let items: [CapitalFlowLine] = [];
for (let _item in _items) {
items.push(CapitalFlowLine.new(_item));
}
return items;
}
Get capital flow intraday
capital_flow
pub fn capital_flow(self, symbol: string): [CapitalFlowLine] throws OpenApiError
[src]
pub fn capital_flow(self, symbol: string): [CapitalFlowLine] throws OpenApiError {
let _items = try self.inner.capital_flow(symbol);
let items: [CapitalFlowLine] = [];
for (let _item in _items) {
items.push(CapitalFlowLine.new(_item));
}
return items;
}
Get capital flow intraday
Get capital flow intraday
See also: https://open.longportapp.com/en/docs/quote/pull/capital-flow-intraday
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let items = try! ctx.capital_flow("700.HK");
capital_distribution
pub fn capital_distribution(self, symbol: string): CapitalDistributionResponse throws OpenApiError
[src]
pub fn capital_distribution(self, symbol: string): CapitalDistributionResponse throws OpenApiError {
return CapitalDistributionResponse.new(try self.inner.capital_distribution(symbol));
}
Get capital distribution
capital_distribution
pub fn capital_distribution(self, symbol: string): CapitalDistributionResponse throws OpenApiError
[src]
pub fn capital_distribution(self, symbol: string): CapitalDistributionResponse throws OpenApiError {
return CapitalDistributionResponse.new(try self.inner.capital_distribution(symbol));
}
Get capital distribution
Get capital distribution
See also: https://open.longportapp.com/en/docs/quote/pull/capital-distribution
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let resp = try! ctx.capital_distribution("700.HK");
calc_indexes
pub fn calc_indexes(self, symbols: [string], indexes: [CalcIndex]): [SecurityCalcIndex] throws OpenApiError
[src]
pub fn calc_indexes(
self, symbols: [string], indexes: [CalcIndex]
): [SecurityCalcIndex] throws OpenApiError {
let _indexes: [int] = [];
for (let item in indexes) {
_indexes.push(item as int);
}
let _items = try self.inner.calc_indexes(symbols, _indexes);
let items: [SecurityCalcIndex] = [];
for (let _item in _items) {
items.push(SecurityCalcIndex.new(_item));
}
return items;
}
Calc indexes of the symbols
calc_indexes
pub fn calc_indexes(self, symbols: [string], indexes: [CalcIndex]): [SecurityCalcIndex] throws OpenApiError
[src]
pub fn calc_indexes(
self, symbols: [string], indexes: [CalcIndex]
): [SecurityCalcIndex] throws OpenApiError {
let _indexes: [int] = [];
for (let item in indexes) {
_indexes.push(item as int);
}
let _items = try self.inner.calc_indexes(symbols, _indexes);
let items: [SecurityCalcIndex] = [];
for (let _item in _items) {
items.push(SecurityCalcIndex.new(_item));
}
return items;
}
Calc indexes of the symbols
Calc indexes of the symbols
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, QuoteContext, CalcIndex};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let items = try! ctx.calc_indexes(
["MMM.US", "9988.HK"],
[CalcIndex.LastDone, CalcIndex.ChangeRate]
);
watchlist
pub fn watchlist(self): [WatchlistGroup] throws OpenApiError
[src]
pub fn watchlist(self): [WatchlistGroup] throws OpenApiError {
let _items = try self.inner.watchlist();
let items: [WatchlistGroup] = [];
for (let _item in _items) {
items.push(WatchlistGroup.new(_item));
}
return items;
}
Get watchlist
watchlist
pub fn watchlist(self): [WatchlistGroup] throws OpenApiError
[src]
pub fn watchlist(self): [WatchlistGroup] throws OpenApiError {
let _items = try self.inner.watchlist();
let items: [WatchlistGroup] = [];
for (let _item in _items) {
items.push(WatchlistGroup.new(_item));
}
return items;
}
Get watchlist
Get watchlist
See also: https://open.longportapp.com/en/docs/quote/individual/watchlist_groups
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let items = try! ctx.watchlist();
realtime_candlesticks
pub fn realtime_candlesticks(self, symbol: string, period: Period, count: int): [Candlestick] throws OpenApiError
[src]
pub fn realtime_candlesticks(
self, symbol: string, period: Period, count: int
): [Candlestick] throws OpenApiError {
let _items = try self.inner.realtime_candlesticks(symbol, period as int, count);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get real-time candlesticks
realtime_candlesticks
pub fn realtime_candlesticks(self, symbol: string, period: Period, count: int): [Candlestick] throws OpenApiError
[src]
pub fn realtime_candlesticks(
self, symbol: string, period: Period, count: int
): [Candlestick] throws OpenApiError {
let _items = try self.inner.realtime_candlesticks(symbol, period as int, count);
let items: [Candlestick] = [];
for (let _item in _items) {
items.push(Candlestick.new(_item));
}
return items;
}
Get real-time candlesticks
Get real-time candlesticks
Get real-time candlesticks of the subscribed symbols, it always returns the data in the local storage.
Examples
use longport.Config;
use longport.quote.{self, Period, AdjustType, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe_candlesticks("9988.HK", Period.OneMinute);
let resp = try! ctx.realtime_candlesticks("9988.HK", Period.Day, 10);
realtime_brokers
pub fn realtime_brokers(self, symbol: string): SecurityBrokers throws OpenApiError
[src]
pub fn realtime_brokers(self, symbol: string): SecurityBrokers throws OpenApiError {
return SecurityBrokers.new(try self.inner.realtime_brokers(symbol));
}
Get real-time broker queue
realtime_brokers
pub fn realtime_brokers(self, symbol: string): SecurityBrokers throws OpenApiError
[src]
pub fn realtime_brokers(self, symbol: string): SecurityBrokers throws OpenApiError {
return SecurityBrokers.new(try self.inner.realtime_brokers(symbol));
}
Get real-time broker queue
Get real-time broker queue
Get real-time broker queue of the subscribed symbols, it always returns the data in the local storage.
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
let resp = try! ctx.realtime_brokers("9988.HK");
realtime_trades
pub fn realtime_trades(self, symbol: string, count: int): [Trade] throws OpenApiError
[src]
pub fn realtime_trades(self, symbol: string, count: int): [Trade] throws OpenApiError {
let _items = try self.inner.realtime_trades(symbol, count);
let items: [Trade] = [];
for (let _item in _items) {
items.push(Trade.new(_item));
}
return items;
}
Get real-time trades
realtime_trades
pub fn realtime_trades(self, symbol: string, count: int): [Trade] throws OpenApiError
[src]
pub fn realtime_trades(self, symbol: string, count: int): [Trade] throws OpenApiError {
let _items = try self.inner.realtime_trades(symbol, count);
let items: [Trade] = [];
for (let _item in _items) {
items.push(Trade.new(_item));
}
return items;
}
Get real-time trades
Get real-time trades
Get real-time trades of the subscribed symbols, it always returns the data in the local storage.
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
let trades = try! ctx.realtime_trades("700.HK", 10);
realtime_depth
pub fn realtime_depth(self, symbol: string): SecurityDepth throws OpenApiError
[src]
pub fn realtime_depth(self, symbol: string): SecurityDepth throws OpenApiError {
return SecurityDepth.new(try self.inner.realtime_depth(symbol));
}
Get real-time depth
realtime_depth
pub fn realtime_depth(self, symbol: string): SecurityDepth throws OpenApiError
[src]
pub fn realtime_depth(self, symbol: string): SecurityDepth throws OpenApiError {
return SecurityDepth.new(try self.inner.realtime_depth(symbol));
}
Get real-time depth
Get real-time depth
Get real-time depth of the subscribed symbols, it always returns the data in the local storage.
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
let depth = try! ctx.realtime_depth("700.HK");
realtime_quote
pub fn realtime_quote(self, symbols: [string]): [RealtimeQuote] throws OpenApiError
[src]
pub fn realtime_quote(self, symbols: [string]): [RealtimeQuote] throws OpenApiError {
let _items = try self.inner.realtime_quote(symbols);
let items: [RealtimeQuote] = [];
for (let _item in _items) {
items.push(RealtimeQuote.new(_item));
}
return items;
}
Get real-time quotes
realtime_quote
pub fn realtime_quote(self, symbols: [string]): [RealtimeQuote] throws OpenApiError
[src]
pub fn realtime_quote(self, symbols: [string]): [RealtimeQuote] throws OpenApiError {
let _items = try self.inner.realtime_quote(symbols);
let items: [RealtimeQuote] = [];
for (let _item in _items) {
items.push(RealtimeQuote.new(_item));
}
return items;
}
Get real-time quotes
Get real-time quotes
Get real-time quotes of the subscribed symbols, it always returns the data in the local storage.
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.subscribe(
["MMM.US", "9988.HK"],
quote.QUOTE | quote.DEPTH | quote.BROKER | quote.TRADE,
true
);
let quotes = try! ctx.realtime_quote(["MMM.US", "9988.HK"]);
create_watchlist_group
pub fn create_watchlist_group(self, name: string, securities: [string]? = nil): int throws OpenApiError
[src]
pub fn create_watchlist_group(
self, name: string, securities: [string]? = nil
): int throws OpenApiError {
return try self.inner.create_watchlist_group(name, securities:);
}
Create watchlist group
create_watchlist_group
pub fn create_watchlist_group(self, name: string, securities: [string]? = nil): int throws OpenApiError
[src]
pub fn create_watchlist_group(
self, name: string, securities: [string]? = nil
): int throws OpenApiError {
return try self.inner.create_watchlist_group(name, securities:);
}
Create watchlist group
Create watchlist group
See also: https://open.longportapp.com/en/docs/quote/individual/watchlist_create_group
Examples
use std.time.DateTime;
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
let group_id = try! ctx.create_watchlist_group(
"Watchlist1",
securities: ["700.HK", "BABA.US"]
);
delete_watchlist_group
pub fn delete_watchlist_group(self, id: int, purge: bool) throws OpenApiError
[src]
pub fn delete_watchlist_group(self, id: int, purge: bool) throws OpenApiError {
try self.inner.delete_watchlist_group(id, purge);
}
Delete watchlist group
delete_watchlist_group
pub fn delete_watchlist_group(self, id: int, purge: bool) throws OpenApiError
[src]
pub fn delete_watchlist_group(self, id: int, purge: bool) throws OpenApiError {
try self.inner.delete_watchlist_group(id, purge);
}
Delete watchlist group
Delete watchlist group
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.delete_watchlist_group(10086, true);
update_watchlist_group
pub fn update_watchlist_group(self, id: int, name: string? = nil, securities: [string]? = nil, mode: SecuritiesUpdateMode? = nil) throws OpenApiError
[src]
pub fn update_watchlist_group(
self,
id: int,
name: string? = nil,
securities: [string]? = nil,
mode: SecuritiesUpdateMode? = nil
) throws OpenApiError {
try self.inner.update_watchlist_group(id, name:, securities:, mode: mode as int);
}
Update watchlist group
update_watchlist_group
pub fn update_watchlist_group(self, id: int, name: string? = nil, securities: [string]? = nil, mode: SecuritiesUpdateMode? = nil) throws OpenApiError
[src]
pub fn update_watchlist_group(
self,
id: int,
name: string? = nil,
securities: [string]? = nil,
mode: SecuritiesUpdateMode? = nil
) throws OpenApiError {
try self.inner.update_watchlist_group(id, name:, securities:, mode: mode as int);
}
Update watchlist group
Update watchlist group
Examples
use longport.Config;
use longport.quote.{self, QuoteContext};
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.update_watchlist_group(10086, name: "Watchlist2");
try! ctx.update_watchlist_group(10086, securities: ["700.HK", "BABA.US"]);
security_list
pub fn security_list(self, market: Market, category: SecurityListCategory): [Security] throws OpenApiError
[src]
pub fn security_list(
self, market: Market, category: SecurityListCategory
): [Security] throws OpenApiError {
let _items = try self.inner.security_list(market as int, category as int);
let items: [Security] = [];
for (let _item in _items) {
items.push(Security.new(_item));
}
return items;
}
Get security list
security_list
pub fn security_list(self, market: Market, category: SecurityListCategory): [Security] throws OpenApiError
[src]
pub fn security_list(
self, market: Market, category: SecurityListCategory
): [Security] throws OpenApiError {
let _items = try self.inner.security_list(market as int, category as int);
let items: [Security] = [];
for (let _item in _items) {
items.push(Security.new(_item));
}
return items;
}
Get security list
Get security list
Examples
use longport.Config;
use longport.quote.{self, QuoteContext, SecurityListCategory};
use longport.Market;
let config = try! Config.from_env();
let ctx = try! QuoteContext.new(config);
try! ctx.security_list(Market.HK, SecurityListCategory.Overnight);