@n1xyz/nord-ts 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +184 -0
- package/dist/client/Nord.d.ts +1 -13
- package/dist/client/Nord.js +759 -0
- package/dist/client/NordAdmin.js +362 -0
- package/dist/client/NordUser.d.ts +3 -1
- package/dist/client/NordUser.js +752 -0
- package/dist/const.js +27 -0
- package/dist/error.js +51 -0
- package/dist/gen/nord_pb.d.ts +132 -114
- package/dist/gen/nord_pb.js +1068 -0
- package/dist/gen/openapi.d.ts +153 -123
- package/dist/gen/openapi.js +5 -0
- package/dist/index.browser.js +64196 -83277
- package/dist/index.common.js +60080 -86747
- package/dist/index.js +10 -0
- package/dist/nord/api/actions.d.ts +128 -0
- package/dist/nord/api/actions.js +396 -0
- package/dist/nord/api/core.d.ts +16 -0
- package/dist/nord/api/core.js +81 -0
- package/dist/nord/api/metrics.d.ts +67 -0
- package/dist/nord/api/metrics.js +229 -0
- package/dist/nord/api/triggers.d.ts +7 -0
- package/dist/nord/api/triggers.js +38 -0
- package/dist/nord/client/Nord.d.ts +387 -0
- package/dist/nord/client/Nord.js +747 -0
- package/dist/nord/client/NordAdmin.d.ts +226 -0
- package/dist/nord/client/NordAdmin.js +410 -0
- package/dist/nord/client/NordClient.d.ts +16 -0
- package/dist/nord/client/NordClient.js +28 -0
- package/dist/nord/client/NordUser.d.ts +379 -0
- package/dist/nord/client/NordUser.js +787 -0
- package/dist/nord/index.d.ts +8 -0
- package/dist/nord/index.js +34 -0
- package/dist/nord/models/Subscriber.d.ts +37 -0
- package/dist/nord/models/Subscriber.js +25 -0
- package/dist/nord/utils/NordError.d.ts +35 -0
- package/dist/nord/utils/NordError.js +49 -0
- package/dist/types.d.ts +2 -4
- package/dist/types.js +92 -0
- package/dist/utils.js +193 -0
- package/dist/websocket/NordWebSocketClient.js +242 -0
- package/dist/websocket/Subscriber.js +24 -0
- package/dist/websocket/events.js +1 -0
- package/dist/websocket/index.js +80 -0
- package/package.json +1 -1
package/dist/gen/openapi.d.ts
CHANGED
|
@@ -37,6 +37,41 @@ export interface paths {
|
|
|
37
37
|
patch?: never;
|
|
38
38
|
trace?: never;
|
|
39
39
|
};
|
|
40
|
+
"/schema.proto": {
|
|
41
|
+
parameters: {
|
|
42
|
+
query?: never;
|
|
43
|
+
header?: never;
|
|
44
|
+
path?: never;
|
|
45
|
+
cookie?: never;
|
|
46
|
+
};
|
|
47
|
+
get: {
|
|
48
|
+
parameters: {
|
|
49
|
+
query?: never;
|
|
50
|
+
header?: never;
|
|
51
|
+
path?: never;
|
|
52
|
+
cookie?: never;
|
|
53
|
+
};
|
|
54
|
+
requestBody?: never;
|
|
55
|
+
responses: {
|
|
56
|
+
/** @description plain text */
|
|
57
|
+
200: {
|
|
58
|
+
headers: {
|
|
59
|
+
[name: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
content: {
|
|
62
|
+
"text/plain; charset=utf-8": unknown;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
put?: never;
|
|
68
|
+
post?: never;
|
|
69
|
+
delete?: never;
|
|
70
|
+
options?: never;
|
|
71
|
+
head?: never;
|
|
72
|
+
patch?: never;
|
|
73
|
+
trace?: never;
|
|
74
|
+
};
|
|
40
75
|
"/info": {
|
|
41
76
|
parameters: {
|
|
42
77
|
query?: never;
|
|
@@ -687,21 +722,19 @@ export interface paths {
|
|
|
687
722
|
patch?: never;
|
|
688
723
|
trace?: never;
|
|
689
724
|
};
|
|
690
|
-
"/account/{account_id}/pnl": {
|
|
725
|
+
"/account/{account_id}/history/pnl": {
|
|
691
726
|
parameters: {
|
|
692
727
|
query?: never;
|
|
693
728
|
header?: never;
|
|
694
729
|
path?: never;
|
|
695
730
|
cookie?: never;
|
|
696
731
|
};
|
|
697
|
-
/** @description
|
|
698
|
-
*
|
|
699
|
-
* Pagination Results include account PnL records with timestamp, account_id, action_id, and pnl value. Use query parameters `since` and `until` for time-based filtering, and `startInclusive` for pagination.
|
|
700
|
-
*
|
|
701
|
-
* To fetch more data, use the same `since` and `until` parameters and set `startInclusive` to the `nextStartInclusive` value from the previous response. If `nextStartInclusive` is absent, it means there's no more data to fetch, even if the max number of entries were returned. */
|
|
732
|
+
/** @description Fetch full history of PnL updates for an account. */
|
|
702
733
|
get: {
|
|
703
734
|
parameters: {
|
|
704
735
|
query?: {
|
|
736
|
+
/** @description Optional market filter by market id. */
|
|
737
|
+
marketId?: number | null;
|
|
705
738
|
/** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
|
|
706
739
|
since?: string;
|
|
707
740
|
/** @description end with this timestamp (RFC3339); defaults to current date-time */
|
|
@@ -728,6 +761,14 @@ export interface paths {
|
|
|
728
761
|
"application/json": components["schemas"]["PageResult_for_String_and_AccountPnlInfo"];
|
|
729
762
|
};
|
|
730
763
|
};
|
|
764
|
+
404: {
|
|
765
|
+
headers: {
|
|
766
|
+
[name: string]: unknown;
|
|
767
|
+
};
|
|
768
|
+
content: {
|
|
769
|
+
"application/json": components["schemas"]["UserNotFound"];
|
|
770
|
+
};
|
|
771
|
+
};
|
|
731
772
|
};
|
|
732
773
|
};
|
|
733
774
|
put?: never;
|
|
@@ -738,30 +779,31 @@ export interface paths {
|
|
|
738
779
|
patch?: never;
|
|
739
780
|
trace?: never;
|
|
740
781
|
};
|
|
741
|
-
"/account/{account_id}/
|
|
782
|
+
"/account/{account_id}/history/funding": {
|
|
742
783
|
parameters: {
|
|
743
784
|
query?: never;
|
|
744
785
|
header?: never;
|
|
745
786
|
path?: never;
|
|
746
787
|
cookie?: never;
|
|
747
788
|
};
|
|
748
|
-
/** @description
|
|
749
|
-
*
|
|
750
|
-
* will return - used payed funding for 11:00-12.00, using last position before 12:00 capture using funding index formed at 11:30 and market funding index formed at 12:00 - 12:00 - 13:00 PnL will not be returned at all.
|
|
751
|
-
*
|
|
752
|
-
* For exact applied PnL use more per trade PnL. */
|
|
789
|
+
/** @description Fetch full history of funding payments for an account. */
|
|
753
790
|
get: {
|
|
754
791
|
parameters: {
|
|
755
792
|
query?: {
|
|
756
|
-
/** @description Optional market filter by market id
|
|
793
|
+
/** @description Optional market filter by market id. */
|
|
757
794
|
marketId?: number | null;
|
|
758
|
-
/** @description
|
|
759
|
-
count?: number;
|
|
795
|
+
/** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
|
|
760
796
|
since?: string;
|
|
797
|
+
/** @description end with this timestamp (RFC3339); defaults to current date-time */
|
|
798
|
+
until?: string;
|
|
799
|
+
/** @description fetch results starting with this page; query starts with first entry if page isn't specified */
|
|
800
|
+
startInclusive?: string | null;
|
|
801
|
+
/** @description Query returns up to 50 trades in one go. */
|
|
802
|
+
pageSize?: number | null;
|
|
761
803
|
};
|
|
762
804
|
header?: never;
|
|
763
805
|
path: {
|
|
764
|
-
/** @description Account for which to retrieve
|
|
806
|
+
/** @description Account for which to retrieve funding history */
|
|
765
807
|
account_id: number;
|
|
766
808
|
};
|
|
767
809
|
cookie?: never;
|
|
@@ -773,7 +815,7 @@ export interface paths {
|
|
|
773
815
|
[name: string]: unknown;
|
|
774
816
|
};
|
|
775
817
|
content: {
|
|
776
|
-
"application/json": components["schemas"]["
|
|
818
|
+
"application/json": components["schemas"]["PageResult_for_String_and_AccountFundingInfo"];
|
|
777
819
|
};
|
|
778
820
|
};
|
|
779
821
|
400: {
|
|
@@ -1491,53 +1533,6 @@ export interface paths {
|
|
|
1491
1533
|
patch?: never;
|
|
1492
1534
|
trace?: never;
|
|
1493
1535
|
};
|
|
1494
|
-
"/market/{market_id}/price/prev": {
|
|
1495
|
-
parameters: {
|
|
1496
|
-
query?: never;
|
|
1497
|
-
header?: never;
|
|
1498
|
-
path?: never;
|
|
1499
|
-
cookie?: never;
|
|
1500
|
-
};
|
|
1501
|
-
/** @description Fetch the latest price for a market at or before a timestamp. */
|
|
1502
|
-
get: {
|
|
1503
|
-
parameters: {
|
|
1504
|
-
query: {
|
|
1505
|
-
atOrBefore: string;
|
|
1506
|
-
};
|
|
1507
|
-
header?: never;
|
|
1508
|
-
path: {
|
|
1509
|
-
market_id: number;
|
|
1510
|
-
};
|
|
1511
|
-
cookie?: never;
|
|
1512
|
-
};
|
|
1513
|
-
requestBody?: never;
|
|
1514
|
-
responses: {
|
|
1515
|
-
200: {
|
|
1516
|
-
headers: {
|
|
1517
|
-
[name: string]: unknown;
|
|
1518
|
-
};
|
|
1519
|
-
content: {
|
|
1520
|
-
"application/json": components["schemas"]["PreviousMarketPrice"];
|
|
1521
|
-
};
|
|
1522
|
-
};
|
|
1523
|
-
404: {
|
|
1524
|
-
headers: {
|
|
1525
|
-
[name: string]: unknown;
|
|
1526
|
-
};
|
|
1527
|
-
content: {
|
|
1528
|
-
"application/json": components["schemas"]["MarketNotFound"];
|
|
1529
|
-
};
|
|
1530
|
-
};
|
|
1531
|
-
};
|
|
1532
|
-
};
|
|
1533
|
-
put?: never;
|
|
1534
|
-
post?: never;
|
|
1535
|
-
delete?: never;
|
|
1536
|
-
options?: never;
|
|
1537
|
-
head?: never;
|
|
1538
|
-
patch?: never;
|
|
1539
|
-
trace?: never;
|
|
1540
|
-
};
|
|
1541
1536
|
"/account/{account_id}/history/withdrawal": {
|
|
1542
1537
|
parameters: {
|
|
1543
1538
|
query?: never;
|
|
@@ -1572,7 +1567,7 @@ export interface paths {
|
|
|
1572
1567
|
[name: string]: unknown;
|
|
1573
1568
|
};
|
|
1574
1569
|
content: {
|
|
1575
|
-
"application/json": components["schemas"]["
|
|
1570
|
+
"application/json": components["schemas"]["PageResult_for_String_and_WithdrawalInfo"];
|
|
1576
1571
|
};
|
|
1577
1572
|
};
|
|
1578
1573
|
404: {
|
|
@@ -2742,20 +2737,20 @@ export interface components {
|
|
|
2742
2737
|
};
|
|
2743
2738
|
MarketStats: {
|
|
2744
2739
|
/** Format: double */
|
|
2745
|
-
indexPrice
|
|
2740
|
+
indexPrice?: number | null;
|
|
2746
2741
|
/** Format: double */
|
|
2747
|
-
indexPriceConf
|
|
2742
|
+
indexPriceConf?: number | null;
|
|
2748
2743
|
frozen?: boolean;
|
|
2749
2744
|
/** Format: double */
|
|
2750
2745
|
volumeBase24h: number;
|
|
2751
2746
|
/** Format: double */
|
|
2752
2747
|
volumeQuote24h: number;
|
|
2753
2748
|
/** Format: double */
|
|
2754
|
-
high24h
|
|
2749
|
+
high24h?: number | null;
|
|
2755
2750
|
/** Format: double */
|
|
2756
|
-
low24h
|
|
2751
|
+
low24h?: number | null;
|
|
2757
2752
|
/** Format: double */
|
|
2758
|
-
close24h
|
|
2753
|
+
close24h?: number | null;
|
|
2759
2754
|
/** Format: double */
|
|
2760
2755
|
prevClose24h?: number | null;
|
|
2761
2756
|
perpStats?: components["schemas"]["PerpMarketStats"] | null;
|
|
@@ -2954,7 +2949,13 @@ export interface components {
|
|
|
2954
2949
|
/** @description See `bankruptcy` in MARKETS.md. In general happens if account does not have enough weighted tokens to covert his debt and negative PnL. */
|
|
2955
2950
|
bankruptcy: boolean;
|
|
2956
2951
|
};
|
|
2957
|
-
|
|
2952
|
+
GetAccountPnlHistoryQuery: {
|
|
2953
|
+
/**
|
|
2954
|
+
* Format: uint32
|
|
2955
|
+
* @description Optional market filter by market id.
|
|
2956
|
+
* @default null
|
|
2957
|
+
*/
|
|
2958
|
+
marketId: number | null;
|
|
2958
2959
|
/**
|
|
2959
2960
|
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
2960
2961
|
* @default null
|
|
@@ -2981,70 +2982,105 @@ export interface components {
|
|
|
2981
2982
|
nextStartInclusive?: string | null;
|
|
2982
2983
|
};
|
|
2983
2984
|
AccountPnlInfo: {
|
|
2985
|
+
/** @description Time of the position update. */
|
|
2984
2986
|
time: string;
|
|
2987
|
+
/** @description Action id of the update. Used for pagination. */
|
|
2985
2988
|
actionId: string;
|
|
2986
|
-
/**
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2989
|
+
/**
|
|
2990
|
+
* Format: uint32
|
|
2991
|
+
* @description Market id of the position update.
|
|
2992
|
+
*/
|
|
2993
|
+
marketId: number;
|
|
2994
|
+
/**
|
|
2995
|
+
* Format: double
|
|
2996
|
+
* @description PnL realized from this position update.
|
|
2997
|
+
*/
|
|
2998
|
+
tradingPnl: number;
|
|
2999
|
+
/**
|
|
3000
|
+
* Format: double
|
|
3001
|
+
* @description Amount of unsettled funding paid to the account. Accumulated funding payments are tracked but only paid out to the account when updates happen. Thus, PnL history might include entries with no trading pnl (for example when opening or extending a position), but will still include funding payments if needed.
|
|
3002
|
+
*/
|
|
3003
|
+
settledFundingPnl: number;
|
|
2992
3004
|
/**
|
|
2993
3005
|
* Format: double
|
|
2994
|
-
* @description
|
|
3006
|
+
* @description Position size at the time of the pnl update. Positive for longs, negative for shorts.
|
|
2995
3007
|
*/
|
|
2996
|
-
|
|
3008
|
+
positionSize: number;
|
|
2997
3009
|
};
|
|
2998
|
-
|
|
2999
|
-
GetAccountPnlFundingHistQuery: {
|
|
3010
|
+
GetAccountFundingHistoryQuery: {
|
|
3000
3011
|
/**
|
|
3001
3012
|
* Format: uint32
|
|
3002
|
-
* @description Optional market filter by market id
|
|
3013
|
+
* @description Optional market filter by market id.
|
|
3003
3014
|
* @default null
|
|
3004
3015
|
*/
|
|
3005
3016
|
marketId: number | null;
|
|
3006
3017
|
/**
|
|
3007
|
-
*
|
|
3008
|
-
* @
|
|
3009
|
-
* @default 24
|
|
3018
|
+
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
3019
|
+
* @default null
|
|
3010
3020
|
*/
|
|
3011
|
-
count: number;
|
|
3012
|
-
/** @default null */
|
|
3013
3021
|
since: string;
|
|
3014
|
-
};
|
|
3015
|
-
AccountPnlHistInfo: {
|
|
3016
|
-
/** @description Same time when funding is applied */
|
|
3017
|
-
time: string;
|
|
3018
3022
|
/**
|
|
3019
|
-
*
|
|
3020
|
-
* @
|
|
3023
|
+
* @description end with this timestamp (RFC3339); defaults to current date-time
|
|
3024
|
+
* @default null
|
|
3021
3025
|
*/
|
|
3022
|
-
|
|
3026
|
+
until: string;
|
|
3027
|
+
/** @description fetch results starting with this page; query starts with first entry if page isn't specified */
|
|
3028
|
+
startInclusive?: string | null;
|
|
3023
3029
|
/**
|
|
3024
|
-
* Format:
|
|
3025
|
-
* @description
|
|
3030
|
+
* Format: uint8
|
|
3031
|
+
* @description Query returns up to 50 trades in one go.
|
|
3032
|
+
* @default null
|
|
3026
3033
|
*/
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3034
|
+
pageSize: number | null;
|
|
3035
|
+
};
|
|
3036
|
+
PageResult_for_String_and_AccountFundingInfo: {
|
|
3037
|
+
/** @description Set of items for requested by query. */
|
|
3038
|
+
items: components["schemas"]["AccountFundingInfo"][];
|
|
3039
|
+
/** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
|
|
3040
|
+
nextStartInclusive?: string | null;
|
|
3041
|
+
};
|
|
3042
|
+
AccountFundingInfo: {
|
|
3043
|
+
/** @description Time of the position update. */
|
|
3044
|
+
time: string;
|
|
3045
|
+
/** @description Action id of the update. Used for pagination. */
|
|
3046
|
+
actionId: string;
|
|
3047
|
+
/**
|
|
3048
|
+
* Format: uint32
|
|
3049
|
+
* @description Market id of the position update.
|
|
3050
|
+
*/
|
|
3051
|
+
marketId: number;
|
|
3030
3052
|
/**
|
|
3031
3053
|
* Format: double
|
|
3032
|
-
* @description
|
|
3054
|
+
* @description Position size at the time of the pnl update. Positive for longs, negative for shorts.
|
|
3033
3055
|
*/
|
|
3034
|
-
|
|
3056
|
+
positionSize: number;
|
|
3035
3057
|
/**
|
|
3036
3058
|
* Format: double
|
|
3037
|
-
* @description Funding
|
|
3059
|
+
* @description Funding paid to the account for this funding period.
|
|
3038
3060
|
*/
|
|
3039
3061
|
fundingPnl: number;
|
|
3040
|
-
market: components["schemas"]["MarketIdInfo"];
|
|
3041
|
-
};
|
|
3042
|
-
MarketIdInfo: {
|
|
3043
|
-
/** Format: uint32 */
|
|
3044
|
-
market_id: number;
|
|
3045
|
-
market_symbol: string;
|
|
3046
3062
|
};
|
|
3047
3063
|
BadRequest: null;
|
|
3064
|
+
PagedQuery: {
|
|
3065
|
+
/**
|
|
3066
|
+
* @description start with this timestamp (RFC3339); defaults to UNIX epoch start
|
|
3067
|
+
* @default null
|
|
3068
|
+
*/
|
|
3069
|
+
since: string;
|
|
3070
|
+
/**
|
|
3071
|
+
* @description end with this timestamp (RFC3339); defaults to current date-time
|
|
3072
|
+
* @default null
|
|
3073
|
+
*/
|
|
3074
|
+
until: string;
|
|
3075
|
+
/** @description fetch results starting with this page; query starts with first entry if page isn't specified */
|
|
3076
|
+
startInclusive?: string | null;
|
|
3077
|
+
/**
|
|
3078
|
+
* Format: uint8
|
|
3079
|
+
* @description Query returns up to 50 trades in one go.
|
|
3080
|
+
* @default null
|
|
3081
|
+
*/
|
|
3082
|
+
pageSize: number | null;
|
|
3083
|
+
};
|
|
3048
3084
|
PageResult_for_String_and_Trigger: {
|
|
3049
3085
|
/** @description Set of items for requested by query. */
|
|
3050
3086
|
items: components["schemas"]["Trigger"][];
|
|
@@ -3268,34 +3304,26 @@ export interface components {
|
|
|
3268
3304
|
/** Format: double */
|
|
3269
3305
|
volumeQuote: number;
|
|
3270
3306
|
};
|
|
3271
|
-
|
|
3272
|
-
atOrBefore: string;
|
|
3273
|
-
};
|
|
3274
|
-
PreviousMarketPrice: {
|
|
3275
|
-
/** Format: uint32 */
|
|
3276
|
-
marketId: number;
|
|
3277
|
-
/** Format: double */
|
|
3278
|
-
price?: number | null;
|
|
3279
|
-
};
|
|
3280
|
-
PageResult_for_String_and_Withdrawal: {
|
|
3307
|
+
PageResult_for_String_and_WithdrawalInfo: {
|
|
3281
3308
|
/** @description Set of items for requested by query. */
|
|
3282
|
-
items: components["schemas"]["
|
|
3309
|
+
items: components["schemas"]["WithdrawalInfo"][];
|
|
3283
3310
|
/** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
|
|
3284
3311
|
nextStartInclusive?: string | null;
|
|
3285
3312
|
};
|
|
3286
|
-
|
|
3313
|
+
WithdrawalInfo: {
|
|
3287
3314
|
time: string;
|
|
3288
3315
|
actionId: string;
|
|
3289
3316
|
/** Format: uint32 */
|
|
3290
3317
|
accountId: number;
|
|
3291
3318
|
/** Format: uint32 */
|
|
3292
3319
|
tokenId: number;
|
|
3293
|
-
/** Format:
|
|
3320
|
+
/** Format: double */
|
|
3294
3321
|
amount: number;
|
|
3295
|
-
/** Format:
|
|
3322
|
+
/** Format: double */
|
|
3296
3323
|
balance: number;
|
|
3297
|
-
/** Format:
|
|
3324
|
+
/** Format: double */
|
|
3298
3325
|
fee: number;
|
|
3326
|
+
destPubkey?: string | null;
|
|
3299
3327
|
};
|
|
3300
3328
|
PageResult_for_String_and_DepositInfo: {
|
|
3301
3329
|
/** @description Set of items for requested by query. */
|
|
@@ -3395,6 +3423,8 @@ export interface components {
|
|
|
3395
3423
|
description: string;
|
|
3396
3424
|
exchange: string;
|
|
3397
3425
|
has_intraday: boolean;
|
|
3426
|
+
has_empty_bars: boolean;
|
|
3427
|
+
has_weekly_and_monthly: boolean;
|
|
3398
3428
|
format: components["schemas"]["TvSymbolsFormat"];
|
|
3399
3429
|
listed_exchange: string;
|
|
3400
3430
|
/** Format: int64 */
|