longbridge
Advanced tools
Comparing version 0.2.10 to 0.2.11
148
index.d.ts
@@ -148,3 +148,2 @@ /* tslint:disable */ | ||
} | ||
export function sleep(milliseconds: number): Promise<void> | ||
/** Topic type */ | ||
@@ -370,8 +369,80 @@ export const enum TopicType { | ||
neg(): Decimal | ||
gt(other: Decimal): boolean | ||
ge(other: Decimal): boolean | ||
eq(other: Decimal): boolean | ||
lt(other: Decimal): boolean | ||
le(other: Decimal): boolean | ||
compare(other: Decimal): number | ||
/** | ||
* Returns `true` if the value of this Decimal is greater than the value of | ||
* `x`, otherwise returns `false`. | ||
*/ | ||
greaterThan(other: Decimal): boolean | ||
/** | ||
* Returns `true` if the value of this Decimal is greater than or equal to | ||
* the value of `x`, otherwise returns `false`. | ||
*/ | ||
greaterThanOrEqualTo(other: Decimal): boolean | ||
/** | ||
* Returns `true` if the value of this Decimal equals the value of `x`, | ||
* otherwise returns `false`. | ||
*/ | ||
equals(other: Decimal): boolean | ||
/** | ||
* Returns `true` if the value of this Decimal is less than the value of | ||
* `x`, otherwise returns `false`. | ||
*/ | ||
lessThan(other: Decimal): boolean | ||
/** | ||
* Returns `true` if the value of this Decimal is less than or equal to the | ||
* value of `x`, otherwise returns `false`. | ||
*/ | ||
lessThanOrEqualTo(other: Decimal): boolean | ||
/** | ||
* Compares the values of two Decimals. | ||
* | ||
* Returns `-1` if the value of this Decimal is less than the value of | ||
* `x`. | ||
* | ||
* Returns `1` if the value of this Decimal is greater than the value of | ||
* `x`. | ||
* | ||
* Returns `0` if the value of this Decimal equals the value of `x`. | ||
*/ | ||
comparedTo(other: Decimal): number | ||
/** Computes the sine of a number (in radians) */ | ||
sin(): this | ||
/** Computes the cosine of a number (in radians) */ | ||
cos(): this | ||
/** | ||
* Computes the tangent of a number (in radians). Panics upon overflow or | ||
* upon approaching a limit. | ||
*/ | ||
tan(): this | ||
/** The square root of a Decimal. Uses a standard Babylonian method. */ | ||
sqrt(): this | ||
/** | ||
* Raise self to the given Decimal exponent: x<sup>y</sup>. If `exp` is not | ||
* whole then the approximation e<sup>y*ln(x)</sup> is used. | ||
*/ | ||
pow(exp: Decimal): this | ||
/** | ||
* Calculates the natural logarithm for a Decimal calculated using Taylor’s | ||
* series. | ||
*/ | ||
ln(): this | ||
/** Calculates the base 10 logarithm of a specified Decimal number. */ | ||
log10(): this | ||
/** | ||
* The estimated exponential function, ex. Stops calculating when it is | ||
* within tolerance of roughly `0.0000002`. | ||
*/ | ||
exp(): this | ||
/** | ||
* The estimated exponential function, e<sup>x</sup> using the `tolerance` | ||
* provided as a hint as to when to stop calculating. A larger | ||
* tolerance will cause the number to stop calculating sooner at the | ||
* potential cost of a slightly less accurate result. | ||
*/ | ||
expWithTolerance(tolerance: Decimal): this | ||
/** Abramowitz Approximation of Error Function from [wikipedia](https://en.wikipedia.org/wiki/Error_function#Numerical_approximations) */ | ||
erf(): Decimal | ||
/** The Cumulative distribution function for a Normal distribution */ | ||
normCdf(): Decimal | ||
/** The Probability density function for a Normal distribution. */ | ||
normPdf(): this | ||
} | ||
@@ -415,2 +486,19 @@ /** Quote context */ | ||
/** | ||
* Get subscription information | ||
* | ||
* #### Example | ||
* | ||
* ```javascript | ||
* import { Config, QuoteContext, SubType } from 'longbridge' | ||
* | ||
* let config = Config.fromEnv() | ||
* let ctx = new QuoteContext(config) | ||
* await ctx.open() | ||
* await ctx.subscribe(["700.HK", "AAPL.US"], [SubType.Quote], true) | ||
* let resp = await ctx.subscriptions() | ||
* console.log(resp.toString()) | ||
* ``` | ||
*/ | ||
subscriptions(): Promise<Array<Subscription>> | ||
/** | ||
* Get basic information of securities | ||
@@ -692,8 +780,8 @@ * | ||
* | ||
* await sleep(5000) | ||
* | ||
* let resp = await ctx.realtimeQuote(["HK.700", "AAPL.US"]) | ||
* for (let obj of resp) { | ||
* console.log(obj.toString()) | ||
* } | ||
* setTimeout(() => { | ||
* let resp = await ctx.realtimeQuote(["HK.700", "AAPL.US"]) | ||
* for (let obj of resp) { | ||
* console.log(obj.toString()) | ||
* } | ||
* }, 5000) | ||
* ``` | ||
@@ -715,6 +803,6 @@ */ | ||
* | ||
* await sleep(5000) | ||
* | ||
* let resp = await ctx.realtimeDepth("HK.700") | ||
* console.log(resp.toString()) | ||
* setTimeout(() => { | ||
* let resp = await ctx.realtimeDepth("HK.700") | ||
* console.log(resp.toString()) | ||
* }, 5000) | ||
* ``` | ||
@@ -736,6 +824,6 @@ */ | ||
* | ||
* await sleep(5000) | ||
* | ||
* let resp = await ctx.realtimeBrokers("HK.700") | ||
* console.log(resp.toString()) | ||
* setTimeout(() => { | ||
* let resp = await ctx.realtimeBrokers("HK.700") | ||
* console.log(resp.toString()) | ||
* }, 5000) | ||
* ``` | ||
@@ -757,8 +845,8 @@ */ | ||
* | ||
* await sleep(5000) | ||
* | ||
* let resp = await ctx.realtimeTrades("HK.700") | ||
* for (let obj of resp) { | ||
* console.log(obj.toString()) | ||
* } | ||
* setTimeout(() => { | ||
* let resp = await ctx.realtimeTrades("HK.700") | ||
* for (let obj of resp) { | ||
* console.log(obj.toString()) | ||
* } | ||
* }, 5000) | ||
* ``` | ||
@@ -784,2 +872,8 @@ */ | ||
} | ||
/** Subscription */ | ||
export class Subscription { | ||
toString(): string | ||
get symbol(): string | ||
get subTypes(): Array<SubType> | ||
} | ||
/** The basic information of securities */ | ||
@@ -786,0 +880,0 @@ export class SecurityStaticInfo { |
@@ -239,3 +239,3 @@ const { existsSync, readFileSync } = require('fs') | ||
const { Config, Decimal, QuoteContext, PushQuoteEvent, PushDepthEvent, PushBrokersEvent, PushTradesEvent, DerivativeType, TradeStatus, TradeSession, SubType, TradeDirection, OptionType, OptionDirection, WarrantType, Period, AdjustType, SecurityStaticInfo, PrePostQuote, SecurityQuote, OptionQuote, WarrantQuote, Depth, SecurityDepth, Brokers, SecurityBrokers, ParticipantInfo, Trade, IntradayLine, Candlestick, StrikePriceInfo, IssuerInfo, TradingSessionInfo, MarketTradingSession, RealtimeQuote, PushQuote, PushDepth, PushBrokers, PushTrades, MarketTradingDays, NaiveDate, Time, sleep, TradeContext, GetCashFlowOptions, GetHistoryExecutionsOptions, GetHistoryOrdersOptions, GetTodayExecutionsOptions, GetTodayOrdersOptions, ReplaceOrderOptions, SubmitOrderOptions, TopicType, Execution, OrderStatus, OrderSide, OrderType, OrderTag, TimeInForceType, TriggerStatus, OutsideRTH, Order, PushOrderChanged, SubmitOrderResponse, CashInfo, AccountBalance, BalanceType, CashFlowDirection, CashFlow, FundPositionsResponse, FundPositionChannel, FundPosition, StockPositionsResponse, StockPositionChannel, StockPosition, Market } = nativeBinding | ||
const { Config, Decimal, QuoteContext, PushQuoteEvent, PushDepthEvent, PushBrokersEvent, PushTradesEvent, Subscription, DerivativeType, TradeStatus, TradeSession, SubType, TradeDirection, OptionType, OptionDirection, WarrantType, Period, AdjustType, SecurityStaticInfo, PrePostQuote, SecurityQuote, OptionQuote, WarrantQuote, Depth, SecurityDepth, Brokers, SecurityBrokers, ParticipantInfo, Trade, IntradayLine, Candlestick, StrikePriceInfo, IssuerInfo, TradingSessionInfo, MarketTradingSession, RealtimeQuote, PushQuote, PushDepth, PushBrokers, PushTrades, MarketTradingDays, NaiveDate, Time, TradeContext, GetCashFlowOptions, GetHistoryExecutionsOptions, GetHistoryOrdersOptions, GetTodayExecutionsOptions, GetTodayOrdersOptions, ReplaceOrderOptions, SubmitOrderOptions, TopicType, Execution, OrderStatus, OrderSide, OrderType, OrderTag, TimeInForceType, TriggerStatus, OutsideRTH, Order, PushOrderChanged, SubmitOrderResponse, CashInfo, AccountBalance, BalanceType, CashFlowDirection, CashFlow, FundPositionsResponse, FundPositionChannel, FundPosition, StockPositionsResponse, StockPositionChannel, StockPosition, Market } = nativeBinding | ||
@@ -249,2 +249,3 @@ module.exports.Config = Config | ||
module.exports.PushTradesEvent = PushTradesEvent | ||
module.exports.Subscription = Subscription | ||
module.exports.DerivativeType = DerivativeType | ||
@@ -285,3 +286,2 @@ module.exports.TradeStatus = TradeStatus | ||
module.exports.Time = Time | ||
module.exports.sleep = sleep | ||
module.exports.TradeContext = TradeContext | ||
@@ -288,0 +288,0 @@ module.exports.GetCashFlowOptions = GetCashFlowOptions |
{ | ||
"name": "longbridge", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"main": "index.js", | ||
@@ -35,7 +35,7 @@ "types": "index.d.ts", | ||
"optionalDependencies": { | ||
"longbridge-win32-x64-msvc": "0.2.10", | ||
"longbridge-darwin-x64": "0.2.10", | ||
"longbridge-linux-x64-gnu": "0.2.10", | ||
"longbridge-darwin-arm64": "0.2.10" | ||
"longbridge-win32-x64-msvc": "0.2.11", | ||
"longbridge-darwin-x64": "0.2.11", | ||
"longbridge-linux-x64-gnu": "0.2.11", | ||
"longbridge-darwin-arm64": "0.2.11" | ||
} | ||
} |
62690
2144