longbridge
Advanced tools
Comparing version 0.2.59 to 0.2.60
241
index.d.ts
@@ -206,2 +206,11 @@ /* tslint:disable */ | ||
/** Options for get cash flow request */ | ||
export interface EstimateMaxPurchaseQuantityOptions { | ||
symbol: string | ||
orderType: OrderType | ||
side: OrderSide | ||
price?: Decimal | ||
currency?: string | ||
orderId?: string | ||
} | ||
/** Options for get cash flow request */ | ||
export interface GetCashFlowOptions { | ||
@@ -406,3 +415,15 @@ /** Start time */ | ||
/** Grey Order */ | ||
Grey = 3 | ||
Grey = 3, | ||
/** Force Selling */ | ||
MarginCall = 4, | ||
/** OTC */ | ||
Offline = 5, | ||
/** Option Exercise Long */ | ||
Creditor = 6, | ||
/** Option Exercise Short */ | ||
Debtor = 7, | ||
/** Wavier Of Option Exercise */ | ||
NonExercise = 8, | ||
/** Trade Allocation */ | ||
AllocatedSub = 9 | ||
} | ||
@@ -440,2 +461,37 @@ /** Time in force type */ | ||
} | ||
/** Commission-free Status */ | ||
export const enum CommissionFreeStatus { | ||
/** Unknown */ | ||
Unknown = 0, | ||
/** None */ | ||
None = 1, | ||
/** Commission-free amount to be calculated */ | ||
Calculated = 2, | ||
/** Pending commission-free */ | ||
Pending = 3, | ||
/** Commission-free applied */ | ||
Ready = 4 | ||
} | ||
/** Deduction status */ | ||
export const enum DeductionStatus { | ||
/** Unknown */ | ||
Unknown = 0, | ||
/** Pending Settlement */ | ||
None = 1, | ||
/** Settled with no data */ | ||
NoData = 2, | ||
/** Settled and pending distribution */ | ||
Pending = 3, | ||
/** Settled and distributed */ | ||
Done = 4 | ||
} | ||
/** Charge category code */ | ||
export const enum ChargeCategoryCode { | ||
/** Unknown */ | ||
Unknown = 0, | ||
/** Broker */ | ||
Broker = 1, | ||
/** Third */ | ||
Third = 2 | ||
} | ||
export const enum BalanceType { | ||
@@ -666,3 +722,3 @@ /** Unknown */ | ||
/** Performs a HTTP request */ | ||
request(method: string, path: string, body?: any | undefined | null): Promise<any> | ||
request(method: string, path: string, headers?: Record<string, string> | undefined | null, body?: any | undefined | null): Promise<any> | ||
} | ||
@@ -1708,3 +1764,3 @@ /** Quote context */ | ||
* TradeContext.new(config) | ||
* .then((ctx) => { | ||
* .then((ctx) => {` | ||
* ctx.setOnQuote((_, event) => console.log(event.toString())); | ||
@@ -1994,2 +2050,37 @@ * ctx.subscribe([TopicType.Private]); | ||
marginRatio(symbol: string): Promise<MarginRatio> | ||
/** | ||
* Get order detail | ||
* | ||
* #### Example | ||
* | ||
* ```javascript | ||
* const { Config, TradeContext } = require("longbridge") | ||
* | ||
* let config = Config.fromEnv() | ||
* TradeContext.new(config) | ||
* .then((ctx) => ctx.orderDetail("701276261045858304")) | ||
* .then((resp) => console.log(resp)) | ||
* ``` | ||
*/ | ||
orderDetail(orderId: string): Promise<OrderDetail> | ||
/** | ||
* Estimating the maximum purchase quantity for Hong Kong and US stocks, | ||
* warrants, and options | ||
* | ||
* #### Example | ||
* | ||
* ```javascript | ||
* const { Config, TradeContext, OrderType, OrderSide } = require("longbridge") | ||
* | ||
* let config = Config.fromEnv() | ||
* TradeContext.new(config) | ||
* .then((ctx) => ctx.estimate_max_purchase_quantity({ | ||
* symbol: "700.HK", | ||
* orderType: OrderType.LO, | ||
* side: OrderSide.Buy, | ||
* })) | ||
* .then((resp) => console.log(resp)) | ||
* ``` | ||
*/ | ||
estimateMaxPurchaseQuantity(opts: EstimateMaxPurchaseQuantityOptions): Promise<EstimateMaxPurchaseQuantityResponse> | ||
} | ||
@@ -2065,3 +2156,135 @@ /** Trade */ | ||
get outsideRth(): OutsideRTH | null | ||
/** Remark */ | ||
get remark(): string | ||
} | ||
/** Order history detail */ | ||
export class OrderHistoryDetail { | ||
toString(): string | ||
/** | ||
* Executed price for executed orders, submitted price for expired, | ||
* canceled, rejected orders, etc. | ||
*/ | ||
get price(): Decimal | ||
/** | ||
* Executed quantity for executed orders, remaining quantity for expired, | ||
* canceled, rejected orders, etc. | ||
*/ | ||
get quantity(): number | ||
/** Order status */ | ||
get status(): OrderStatus | ||
/** Execution or error message */ | ||
get msg(): string | ||
/** Occurrence time */ | ||
get time(): Date | ||
} | ||
/** Order charge fee */ | ||
export class OrderChargeFee { | ||
toString(): string | ||
/** Charge code */ | ||
get code(): string | ||
/** Charge name */ | ||
get name(): string | ||
/** Charge amount */ | ||
get amount(): Decimal | ||
/** Charge currency */ | ||
get currency(): string | ||
} | ||
/** Order charge item */ | ||
export class OrderChargeItem { | ||
toString(): string | ||
/** Charge category code */ | ||
get code(): ChargeCategoryCode | ||
/** Charge category name */ | ||
get name(): string | ||
/** Charge details */ | ||
get fees(): Array<OrderChargeFee> | ||
} | ||
/** Order charge detail */ | ||
export class OrderChargeDetail { | ||
toString(): string | ||
/** Total charges amount */ | ||
get totalAmount(): Decimal | ||
/** Settlement currency */ | ||
get currency(): string | ||
/** Order charge items */ | ||
get items(): Array<OrderChargeItem> | ||
} | ||
/** Order detail */ | ||
export class OrderDetail { | ||
toString(): string | ||
/** Order ID */ | ||
get orderId(): string | ||
/** Order status */ | ||
get status(): OrderStatus | ||
/** Stock name */ | ||
get stockName(): string | ||
/** Submitted quantity */ | ||
get quantity(): number | ||
/** Executed quantity */ | ||
get executedQuantity(): number | ||
/** Submitted price */ | ||
get price(): Decimal | null | ||
/** Executed price */ | ||
get executedPrice(): Decimal | null | ||
/** Submitted time */ | ||
get submittedAt(): Date | ||
/** Order side */ | ||
get side(): OrderSide | ||
/** Security code */ | ||
get symbol(): string | ||
/** Order type */ | ||
get orderType(): OrderType | ||
/** Last done */ | ||
get lastDone(): Decimal | null | ||
/** `LIT` / `MIT` Order Trigger Price */ | ||
get triggerPrice(): Decimal | null | ||
/** Rejected Message or remark */ | ||
get msg(): string | ||
/** Order tag */ | ||
get tag(): OrderTag | ||
/** Time in force type */ | ||
get timeInForce(): TimeInForceType | ||
/** Long term order expire date */ | ||
get expireDate(): NaiveDate | null | ||
/** Last updated time */ | ||
get updatedAt(): Date | null | ||
/** Conditional order trigger time */ | ||
get triggerAt(): Date | null | ||
/** `TSMAMT` / `TSLPAMT` order trailing amount */ | ||
get trailingAmount(): Decimal | null | ||
/** `TSMPCT` / `TSLPPCT` order trailing percent */ | ||
get trailingPercent(): Decimal | null | ||
/** `TSLPAMT` / `TSLPPCT` order limit offset amount */ | ||
get limitOffset(): Decimal | null | ||
/** Conditional order trigger status */ | ||
get triggerStatus(): TriggerStatus | null | ||
/** Currency */ | ||
get currency(): string | ||
/** Enable or disable outside regular trading hours */ | ||
get outsideRth(): OutsideRTH | null | ||
/** Remark */ | ||
get remark(): string | ||
/** Commission-free Status */ | ||
get freeStatus(): CommissionFreeStatus | ||
/** Commission-free amount */ | ||
get freeAmount(): Decimal | null | ||
/** Commission-free currency */ | ||
get freeCurrency(): string | null | ||
/** Deduction status */ | ||
get deductionsStatus(): DeductionStatus | ||
/** Deduction amount */ | ||
get deductionsAmount(): Decimal | null | ||
/** Deduction currency */ | ||
get deductionsCurrency(): string | null | ||
/** Platform fee deduction status */ | ||
get platformDeductedStatus(): DeductionStatus | ||
/** Platform deduction amount */ | ||
get platformDeductedAmount(): Decimal | null | ||
/** Platform deduction currency */ | ||
get platformDeductedCurrency(): string | null | ||
/** Order history details */ | ||
get history(): Array<OrderHistoryDetail> | ||
/** Order charges */ | ||
get chargeDetail(): OrderChargeDetail | ||
} | ||
/** Order changed message */ | ||
@@ -2114,2 +2337,6 @@ export class PushOrderChanged { | ||
get accountNo(): string | ||
/** Last share */ | ||
get lastShare(): Decimal | null | ||
/** Last price */ | ||
get lastPrice(): Decimal | null | ||
} | ||
@@ -2257,1 +2484,9 @@ /** Response for submit order request */ | ||
} | ||
/** Response for estimate maximum purchase quantity */ | ||
export class EstimateMaxPurchaseQuantityResponse { | ||
toString(): string | ||
/** Cash available quantity */ | ||
get cashMaxQty(): number | ||
/** Margin available quantity */ | ||
get marginMaxQty(): number | ||
} |
11
index.js
@@ -239,3 +239,3 @@ const { existsSync, readFileSync } = require('fs') | ||
const { Config, Decimal, HttpClient, QuoteContext, PushQuoteEvent, PushDepthEvent, PushBrokersEvent, PushTradesEvent, PushCandlestickEvent, Subscription, DerivativeType, TradeStatus, TradeSession, SubType, TradeDirection, OptionType, OptionDirection, WarrantType, Period, AdjustType, SecurityBoard, SecurityStaticInfo, PrePostQuote, SecurityQuote, OptionQuote, WarrantQuote, Depth, SecurityDepth, Brokers, SecurityBrokers, ParticipantInfo, Trade, IntradayLine, Candlestick, StrikePriceInfo, IssuerInfo, TradingSessionInfo, MarketTradingSession, RealtimeQuote, PushQuote, PushDepth, PushBrokers, PushTrades, PushCandlestick, MarketTradingDays, CapitalFlowLine, CapitalDistribution, CapitalDistributionResponse, WatchListGroup, WatchListSecurity, NaiveDate, Time, TradeContext, TopicType, Execution, OrderStatus, OrderSide, OrderType, OrderTag, TimeInForceType, TriggerStatus, OutsideRTH, Order, PushOrderChanged, SubmitOrderResponse, CashInfo, AccountBalance, BalanceType, CashFlowDirection, CashFlow, FundPositionsResponse, FundPositionChannel, FundPosition, StockPositionsResponse, StockPositionChannel, StockPosition, MarginRatio, Market, Language } = nativeBinding | ||
const { Config, Decimal, HttpClient, QuoteContext, PushQuoteEvent, PushDepthEvent, PushBrokersEvent, PushTradesEvent, PushCandlestickEvent, Subscription, DerivativeType, TradeStatus, TradeSession, SubType, TradeDirection, OptionType, OptionDirection, WarrantType, Period, AdjustType, SecurityBoard, SecurityStaticInfo, PrePostQuote, SecurityQuote, OptionQuote, WarrantQuote, Depth, SecurityDepth, Brokers, SecurityBrokers, ParticipantInfo, Trade, IntradayLine, Candlestick, StrikePriceInfo, IssuerInfo, TradingSessionInfo, MarketTradingSession, RealtimeQuote, PushQuote, PushDepth, PushBrokers, PushTrades, PushCandlestick, MarketTradingDays, CapitalFlowLine, CapitalDistribution, CapitalDistributionResponse, WatchListGroup, WatchListSecurity, NaiveDate, Time, TradeContext, TopicType, Execution, OrderStatus, OrderSide, OrderType, OrderTag, TimeInForceType, TriggerStatus, OutsideRTH, Order, CommissionFreeStatus, DeductionStatus, ChargeCategoryCode, OrderHistoryDetail, OrderChargeFee, OrderChargeItem, OrderChargeDetail, OrderDetail, PushOrderChanged, SubmitOrderResponse, CashInfo, AccountBalance, BalanceType, CashFlowDirection, CashFlow, FundPositionsResponse, FundPositionChannel, FundPosition, StockPositionsResponse, StockPositionChannel, StockPosition, MarginRatio, EstimateMaxPurchaseQuantityResponse, Market, Language } = nativeBinding | ||
@@ -305,2 +305,10 @@ module.exports.Config = Config | ||
module.exports.Order = Order | ||
module.exports.CommissionFreeStatus = CommissionFreeStatus | ||
module.exports.DeductionStatus = DeductionStatus | ||
module.exports.ChargeCategoryCode = ChargeCategoryCode | ||
module.exports.OrderHistoryDetail = OrderHistoryDetail | ||
module.exports.OrderChargeFee = OrderChargeFee | ||
module.exports.OrderChargeItem = OrderChargeItem | ||
module.exports.OrderChargeDetail = OrderChargeDetail | ||
module.exports.OrderDetail = OrderDetail | ||
module.exports.PushOrderChanged = PushOrderChanged | ||
@@ -320,3 +328,4 @@ module.exports.SubmitOrderResponse = SubmitOrderResponse | ||
module.exports.MarginRatio = MarginRatio | ||
module.exports.EstimateMaxPurchaseQuantityResponse = EstimateMaxPurchaseQuantityResponse | ||
module.exports.Market = Market | ||
module.exports.Language = Language |
{ | ||
"name": "longbridge", | ||
"version": "0.2.59", | ||
"version": "0.2.60", | ||
"main": "index.js", | ||
@@ -35,7 +35,7 @@ "types": "index.d.ts", | ||
"optionalDependencies": { | ||
"longbridge-win32-x64-msvc": "0.2.59", | ||
"longbridge-darwin-x64": "0.2.59", | ||
"longbridge-linux-x64-gnu": "0.2.59", | ||
"longbridge-darwin-arm64": "0.2.59" | ||
"longbridge-win32-x64-msvc": "0.2.60", | ||
"longbridge-darwin-x64": "0.2.60", | ||
"longbridge-linux-x64-gnu": "0.2.60", | ||
"longbridge-darwin-arm64": "0.2.60" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79012
2810