@silvana-one/orderbook 1.1.8 → 1.1.10
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/node/index.cjs +350 -5
- package/dist/node/index.d.ts +3 -1
- package/dist/node/index.js +3 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/news.d.ts +48 -0
- package/dist/node/news.js +63 -0
- package/dist/node/news.js.map +1 -0
- package/dist/node/{grpc.d.ts → orderbook.d.ts} +48 -1
- package/dist/{web/grpc.js → node/orderbook.js} +50 -2
- package/dist/node/orderbook.js.map +1 -0
- package/dist/node/pricing.d.ts +81 -0
- package/dist/node/pricing.js +115 -0
- package/dist/node/pricing.js.map +1 -0
- package/dist/node/proto/silvana/news/v1/news_pb.d.ts +245 -0
- package/dist/node/proto/silvana/news/v1/news_pb.js +44 -0
- package/dist/node/proto/silvana/news/v1/news_pb.js.map +1 -0
- package/dist/node/proto/silvana/orderbook/v1/orderbook_pb.d.ts +398 -0
- package/dist/node/proto/silvana/orderbook/v1/orderbook_pb.js +47 -2
- package/dist/node/proto/silvana/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/node/proto/silvana/pricing/v1/pricing_pb.d.ts +794 -0
- package/dist/node/proto/silvana/pricing/v1/pricing_pb.js +119 -0
- package/dist/node/proto/silvana/pricing/v1/pricing_pb.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.web.tsbuildinfo +1 -1
- package/dist/web/index.d.ts +3 -1
- package/dist/web/index.js +3 -1
- package/dist/web/index.js.map +1 -1
- package/dist/web/news.d.ts +48 -0
- package/dist/web/news.js +63 -0
- package/dist/web/news.js.map +1 -0
- package/dist/web/{grpc.d.ts → orderbook.d.ts} +48 -1
- package/dist/{node/grpc.js → web/orderbook.js} +50 -2
- package/dist/web/orderbook.js.map +1 -0
- package/dist/web/pricing.d.ts +81 -0
- package/dist/web/pricing.js +115 -0
- package/dist/web/pricing.js.map +1 -0
- package/dist/web/proto/silvana/news/v1/news_pb.d.ts +245 -0
- package/dist/web/proto/silvana/news/v1/news_pb.js +44 -0
- package/dist/web/proto/silvana/news/v1/news_pb.js.map +1 -0
- package/dist/web/proto/silvana/orderbook/v1/orderbook_pb.d.ts +398 -0
- package/dist/web/proto/silvana/orderbook/v1/orderbook_pb.js +47 -2
- package/dist/web/proto/silvana/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/web/proto/silvana/pricing/v1/pricing_pb.d.ts +794 -0
- package/dist/web/proto/silvana/pricing/v1/pricing_pb.js +119 -0
- package/dist/web/proto/silvana/pricing/v1/pricing_pb.js.map +1 -0
- package/package.json +5 -2
- package/src/index.ts +3 -1
- package/src/news.ts +105 -0
- package/src/{grpc.ts → orderbook.ts} +91 -0
- package/src/pricing.ts +187 -0
- package/src/proto/silvana/news/v1/news_pb.ts +295 -0
- package/src/proto/silvana/orderbook/v1/orderbook_pb.ts +475 -2
- package/src/proto/silvana/pricing/v1/pricing_pb.ts +950 -0
- package/dist/node/grpc.js.map +0 -1
- package/dist/web/grpc.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createGrpcTransport } from "@connectrpc/connect-node";
|
|
2
|
+
import { createClient, ConnectError } from "@connectrpc/connect";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
// Export all types and schemas from the generated protobuf file
|
|
5
|
+
export * from "./proto/silvana/news/v1/news_pb.js";
|
|
6
|
+
import { NewsService, GetNewsRequestSchema, StreamNewsRequestSchema, } from "./proto/silvana/news/v1/news_pb.js";
|
|
7
|
+
/**
|
|
8
|
+
* Custom error class for News client errors
|
|
9
|
+
*/
|
|
10
|
+
export class NewsError extends Error {
|
|
11
|
+
constructor(message, code, details) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.details = details;
|
|
15
|
+
this.name = 'NewsError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* News client for interacting with the Silvana News Service
|
|
20
|
+
*/
|
|
21
|
+
export class NewsClient {
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new NewsClient instance
|
|
24
|
+
* @param config Client configuration
|
|
25
|
+
*/
|
|
26
|
+
constructor(config) {
|
|
27
|
+
const transport = createGrpcTransport({
|
|
28
|
+
baseUrl: config.baseUrl,
|
|
29
|
+
});
|
|
30
|
+
this.client = createClient(NewsService, transport);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Wraps async calls with error handling
|
|
34
|
+
*/
|
|
35
|
+
async wrapCall(operation, operationName) {
|
|
36
|
+
try {
|
|
37
|
+
return await operation();
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof ConnectError) {
|
|
41
|
+
throw new NewsError(`${operationName} failed: ${error.message}`, String(error.code), error.metadata);
|
|
42
|
+
}
|
|
43
|
+
throw new NewsError(`${operationName} failed: ${error instanceof Error ? error.message : 'Unknown error'}`, 'UNKNOWN', error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get news articles for specific cryptocurrencies
|
|
48
|
+
*/
|
|
49
|
+
async getNews(params) {
|
|
50
|
+
return await this.wrapCall(async () => {
|
|
51
|
+
const request = create(GetNewsRequestSchema, params || {});
|
|
52
|
+
return await this.client.getNews(request);
|
|
53
|
+
}, 'getNews');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Stream real-time news updates
|
|
57
|
+
*/
|
|
58
|
+
streamNews(params) {
|
|
59
|
+
const request = create(StreamNewsRequestSchema, params || {});
|
|
60
|
+
return this.client.streamNews(request);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=news.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"news.js","sourceRoot":"","sources":["../../src/news.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,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EACT,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,MAKb;QACC,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;YACpC,MAAM,OAAO,GAAG,MAAM,CAAC,oBAAoB,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;YAC3D,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC,EAAE,SAAS,CAAC,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,MAGV;QACC,MAAM,OAAO,GAAG,MAAM,CAAC,uBAAuB,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./proto/silvana/orderbook/v1/orderbook_pb.js";
|
|
2
|
-
import { type GetOrdersResponse, type GetOrderbookDepthResponse, type GetSettlementProposalsResponse, type GetInstrumentsResponse, type GetMarketsResponse, type GetOrderHistoryResponse, type GetMarketDataResponse, type GetSettlementsResponse, type SubmitOrderResponse, type CancelOrderResponse, OrderType, OrderStatus, TimeInForce, MarketType, SettlementStatus } from "./proto/silvana/orderbook/v1/orderbook_pb.js";
|
|
2
|
+
import { type GetOrdersResponse, type GetOrderbookDepthResponse, type GetSettlementProposalsResponse, type GetInstrumentsResponse, type GetMarketsResponse, type GetOrderHistoryResponse, type GetMarketDataResponse, type GetSettlementsResponse, type SubmitOrderResponse, type CancelOrderResponse, type CreatePartyResponse, type CreateInstrumentResponse, type CreateMarketResponse, type UpdateMarketPriceFeedsResponse, OrderType, OrderStatus, TimeInForce, MarketType, SettlementStatus } from "./proto/silvana/orderbook/v1/orderbook_pb.js";
|
|
3
3
|
export { OrderType, OrderStatus, TimeInForce, MarketType, SettlementStatus };
|
|
4
4
|
/**
|
|
5
5
|
* Custom error class for Orderbook client errors
|
|
@@ -148,4 +148,51 @@ export declare class OrderbookClient {
|
|
|
148
148
|
subscribeSettlements(params: {
|
|
149
149
|
marketId?: string;
|
|
150
150
|
}): AsyncIterable<import("./proto/silvana/orderbook/v1/orderbook_pb.js").SettlementUpdate>;
|
|
151
|
+
/**
|
|
152
|
+
* Create a new party (admin operation)
|
|
153
|
+
*/
|
|
154
|
+
createParty(params: {
|
|
155
|
+
partyId: string;
|
|
156
|
+
partyName: string;
|
|
157
|
+
partyType: string;
|
|
158
|
+
userServiceCid?: string;
|
|
159
|
+
operatorConfigCid?: string;
|
|
160
|
+
metadata?: any;
|
|
161
|
+
}): Promise<CreatePartyResponse>;
|
|
162
|
+
/**
|
|
163
|
+
* Create a new instrument (admin operation)
|
|
164
|
+
*/
|
|
165
|
+
createInstrument(params: {
|
|
166
|
+
instrumentId: string;
|
|
167
|
+
instrumentType: string;
|
|
168
|
+
name: string;
|
|
169
|
+
symbol: string;
|
|
170
|
+
description?: string;
|
|
171
|
+
issuer?: string;
|
|
172
|
+
registry?: string;
|
|
173
|
+
metadata?: any;
|
|
174
|
+
}): Promise<CreateInstrumentResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Create a new market (admin operation)
|
|
177
|
+
*/
|
|
178
|
+
createMarket(params: {
|
|
179
|
+
marketId: string;
|
|
180
|
+
marketType: MarketType;
|
|
181
|
+
baseInstrument?: string;
|
|
182
|
+
quoteInstrument?: string;
|
|
183
|
+
minOrderSize: string;
|
|
184
|
+
maxOrderSize?: string;
|
|
185
|
+
tickSize: string;
|
|
186
|
+
makerFee: string;
|
|
187
|
+
takerFee: string;
|
|
188
|
+
metadata?: any;
|
|
189
|
+
priceFeeds?: any;
|
|
190
|
+
}): Promise<CreateMarketResponse>;
|
|
191
|
+
/**
|
|
192
|
+
* Update market price feeds (admin operation)
|
|
193
|
+
*/
|
|
194
|
+
updateMarketPriceFeeds(params: {
|
|
195
|
+
marketId: string;
|
|
196
|
+
priceFeeds: any;
|
|
197
|
+
}): Promise<UpdateMarketPriceFeedsResponse>;
|
|
151
198
|
}
|
|
@@ -4,7 +4,7 @@ import { create } from "@bufbuild/protobuf";
|
|
|
4
4
|
import { TimestampSchema } from "@bufbuild/protobuf/wkt";
|
|
5
5
|
// Export all types and schemas from the generated protobuf file
|
|
6
6
|
export * from "./proto/silvana/orderbook/v1/orderbook_pb.js";
|
|
7
|
-
import { OrderbookService, GetOrdersRequestSchema, GetOrderbookDepthRequestSchema, GetSettlementProposalsRequestSchema, GetInstrumentsRequestSchema, GetMarketsRequestSchema, GetOrderHistoryRequestSchema, GetMarketDataRequestSchema, GetSettlementsRequestSchema, SubmitOrderRequestSchema, CancelOrderRequestSchema, SubscribeOrderbookRequestSchema, SubscribeOrdersRequestSchema, SubscribeSettlementsRequestSchema, JWTAuthSchema, OrderType, OrderStatus, TimeInForce, MarketType, SettlementStatus, } from "./proto/silvana/orderbook/v1/orderbook_pb.js";
|
|
7
|
+
import { OrderbookService, GetOrdersRequestSchema, GetOrderbookDepthRequestSchema, GetSettlementProposalsRequestSchema, GetInstrumentsRequestSchema, GetMarketsRequestSchema, GetOrderHistoryRequestSchema, GetMarketDataRequestSchema, GetSettlementsRequestSchema, SubmitOrderRequestSchema, CancelOrderRequestSchema, CreatePartyRequestSchema, CreateInstrumentRequestSchema, CreateMarketRequestSchema, UpdateMarketPriceFeedsRequestSchema, SubscribeOrderbookRequestSchema, SubscribeOrdersRequestSchema, SubscribeSettlementsRequestSchema, JWTAuthSchema, OrderType, OrderStatus, TimeInForce, MarketType, SettlementStatus, } from "./proto/silvana/orderbook/v1/orderbook_pb.js";
|
|
8
8
|
// Re-export commonly used enums for convenience
|
|
9
9
|
export { OrderType, OrderStatus, TimeInForce, MarketType, SettlementStatus };
|
|
10
10
|
/**
|
|
@@ -216,5 +216,53 @@ export class OrderbookClient {
|
|
|
216
216
|
});
|
|
217
217
|
return this.client.subscribeSettlements(request);
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Create a new party (admin operation)
|
|
221
|
+
*/
|
|
222
|
+
async createParty(params) {
|
|
223
|
+
return await this.wrapCall(async () => {
|
|
224
|
+
const request = create(CreatePartyRequestSchema, {
|
|
225
|
+
auth: this.createAuth(),
|
|
226
|
+
...params,
|
|
227
|
+
});
|
|
228
|
+
return await this.client.createParty(request);
|
|
229
|
+
}, 'createParty');
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Create a new instrument (admin operation)
|
|
233
|
+
*/
|
|
234
|
+
async createInstrument(params) {
|
|
235
|
+
return await this.wrapCall(async () => {
|
|
236
|
+
const request = create(CreateInstrumentRequestSchema, {
|
|
237
|
+
auth: this.createAuth(),
|
|
238
|
+
...params,
|
|
239
|
+
});
|
|
240
|
+
return await this.client.createInstrument(request);
|
|
241
|
+
}, 'createInstrument');
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Create a new market (admin operation)
|
|
245
|
+
*/
|
|
246
|
+
async createMarket(params) {
|
|
247
|
+
return await this.wrapCall(async () => {
|
|
248
|
+
const request = create(CreateMarketRequestSchema, {
|
|
249
|
+
auth: this.createAuth(),
|
|
250
|
+
...params,
|
|
251
|
+
});
|
|
252
|
+
return await this.client.createMarket(request);
|
|
253
|
+
}, 'createMarket');
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Update market price feeds (admin operation)
|
|
257
|
+
*/
|
|
258
|
+
async updateMarketPriceFeeds(params) {
|
|
259
|
+
return await this.wrapCall(async () => {
|
|
260
|
+
const request = create(UpdateMarketPriceFeedsRequestSchema, {
|
|
261
|
+
auth: this.createAuth(),
|
|
262
|
+
...params,
|
|
263
|
+
});
|
|
264
|
+
return await this.client.updateMarketPriceFeeds(request);
|
|
265
|
+
}, 'updateMarketPriceFeeds');
|
|
266
|
+
}
|
|
219
267
|
}
|
|
220
|
-
//# sourceMappingURL=
|
|
268
|
+
//# sourceMappingURL=orderbook.js.map
|
|
@@ -0,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AAC,EAAE,wBAAwB,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export * from "./proto/silvana/pricing/v1/pricing_pb.js";
|
|
2
|
+
import { type GetPriceResponse, type GetPricesResponse, type GetKlinesResponse, type GetOrderBookResponse, type GetPivotPointsResponse } from "./proto/silvana/pricing/v1/pricing_pb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Custom error class for Pricing client errors
|
|
5
|
+
*/
|
|
6
|
+
export declare class PricingError extends Error {
|
|
7
|
+
code?: string | undefined;
|
|
8
|
+
details?: any | undefined;
|
|
9
|
+
constructor(message: string, code?: string | undefined, details?: any | undefined);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Pricing client configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface PricingClientConfig {
|
|
15
|
+
/** Base URL of the pricing service (e.g., "http://localhost:50053") */
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Pricing client for interacting with the Silvana Pricing Service
|
|
20
|
+
*/
|
|
21
|
+
export declare class PricingClient {
|
|
22
|
+
private client;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new PricingClient instance
|
|
25
|
+
* @param config Client configuration
|
|
26
|
+
*/
|
|
27
|
+
constructor(config: PricingClientConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Wraps async calls with error handling
|
|
30
|
+
*/
|
|
31
|
+
private wrapCall;
|
|
32
|
+
/**
|
|
33
|
+
* Get current price for a market
|
|
34
|
+
*/
|
|
35
|
+
getPrice(params: {
|
|
36
|
+
marketId: string;
|
|
37
|
+
source?: string;
|
|
38
|
+
}): Promise<GetPriceResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Get multiple market prices
|
|
41
|
+
*/
|
|
42
|
+
getPrices(params: {
|
|
43
|
+
marketIds: string[];
|
|
44
|
+
source?: string;
|
|
45
|
+
}): Promise<GetPricesResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Get kline/candle data
|
|
48
|
+
*/
|
|
49
|
+
getKlines(params: {
|
|
50
|
+
marketId: string;
|
|
51
|
+
interval: string;
|
|
52
|
+
limit?: number;
|
|
53
|
+
startTime?: Date;
|
|
54
|
+
endTime?: Date;
|
|
55
|
+
source?: string;
|
|
56
|
+
}): Promise<GetKlinesResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Get order book snapshot
|
|
59
|
+
*/
|
|
60
|
+
getOrderBook(params: {
|
|
61
|
+
marketId: string;
|
|
62
|
+
depth?: number;
|
|
63
|
+
source?: string;
|
|
64
|
+
}): Promise<GetOrderBookResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Stream real-time price updates
|
|
67
|
+
*/
|
|
68
|
+
streamPrices(params: {
|
|
69
|
+
marketIds: string[];
|
|
70
|
+
includeOrderbook?: boolean;
|
|
71
|
+
includeTrades?: boolean;
|
|
72
|
+
}): AsyncIterable<import("./proto/silvana/pricing/v1/pricing_pb.js").PriceUpdate>;
|
|
73
|
+
/**
|
|
74
|
+
* Get calculated pivot points
|
|
75
|
+
*/
|
|
76
|
+
getPivotPoints(params: {
|
|
77
|
+
marketId: string;
|
|
78
|
+
timeframe: string;
|
|
79
|
+
source?: string;
|
|
80
|
+
}): Promise<GetPivotPointsResponse>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { createGrpcTransport } from "@connectrpc/connect-node";
|
|
2
|
+
import { createClient, ConnectError } from "@connectrpc/connect";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { TimestampSchema } from "@bufbuild/protobuf/wkt";
|
|
5
|
+
// Export all types and schemas from the generated protobuf file
|
|
6
|
+
export * from "./proto/silvana/pricing/v1/pricing_pb.js";
|
|
7
|
+
import { PricingService, GetPriceRequestSchema, GetPricesRequestSchema, GetKlinesRequestSchema, GetOrderBookRequestSchema, StreamPricesRequestSchema, GetPivotPointsRequestSchema, } from "./proto/silvana/pricing/v1/pricing_pb.js";
|
|
8
|
+
/**
|
|
9
|
+
* Converts a Date to a Timestamp message
|
|
10
|
+
*/
|
|
11
|
+
function dateToTimestamp(date) {
|
|
12
|
+
const seconds = BigInt(Math.floor(date.getTime() / 1000));
|
|
13
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
14
|
+
return create(TimestampSchema, { seconds, nanos });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Custom error class for Pricing client errors
|
|
18
|
+
*/
|
|
19
|
+
export class PricingError extends Error {
|
|
20
|
+
constructor(message, code, details) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.details = details;
|
|
24
|
+
this.name = 'PricingError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Pricing client for interacting with the Silvana Pricing Service
|
|
29
|
+
*/
|
|
30
|
+
export class PricingClient {
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new PricingClient instance
|
|
33
|
+
* @param config Client configuration
|
|
34
|
+
*/
|
|
35
|
+
constructor(config) {
|
|
36
|
+
const transport = createGrpcTransport({
|
|
37
|
+
baseUrl: config.baseUrl,
|
|
38
|
+
});
|
|
39
|
+
this.client = createClient(PricingService, transport);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Wraps async calls with error handling
|
|
43
|
+
*/
|
|
44
|
+
async wrapCall(operation, operationName) {
|
|
45
|
+
try {
|
|
46
|
+
return await operation();
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error instanceof ConnectError) {
|
|
50
|
+
throw new PricingError(`${operationName} failed: ${error.message}`, String(error.code), error.metadata);
|
|
51
|
+
}
|
|
52
|
+
throw new PricingError(`${operationName} failed: ${error instanceof Error ? error.message : 'Unknown error'}`, 'UNKNOWN', error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get current price for a market
|
|
57
|
+
*/
|
|
58
|
+
async getPrice(params) {
|
|
59
|
+
return await this.wrapCall(async () => {
|
|
60
|
+
const request = create(GetPriceRequestSchema, params);
|
|
61
|
+
return await this.client.getPrice(request);
|
|
62
|
+
}, 'getPrice');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get multiple market prices
|
|
66
|
+
*/
|
|
67
|
+
async getPrices(params) {
|
|
68
|
+
return await this.wrapCall(async () => {
|
|
69
|
+
const request = create(GetPricesRequestSchema, params);
|
|
70
|
+
return await this.client.getPrices(request);
|
|
71
|
+
}, 'getPrices');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get kline/candle data
|
|
75
|
+
*/
|
|
76
|
+
async getKlines(params) {
|
|
77
|
+
return await this.wrapCall(async () => {
|
|
78
|
+
const request = create(GetKlinesRequestSchema, {
|
|
79
|
+
marketId: params.marketId,
|
|
80
|
+
interval: params.interval,
|
|
81
|
+
limit: params.limit,
|
|
82
|
+
startTime: params.startTime ? dateToTimestamp(params.startTime) : undefined,
|
|
83
|
+
endTime: params.endTime ? dateToTimestamp(params.endTime) : undefined,
|
|
84
|
+
source: params.source,
|
|
85
|
+
});
|
|
86
|
+
return await this.client.getKlines(request);
|
|
87
|
+
}, 'getKlines');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get order book snapshot
|
|
91
|
+
*/
|
|
92
|
+
async getOrderBook(params) {
|
|
93
|
+
return await this.wrapCall(async () => {
|
|
94
|
+
const request = create(GetOrderBookRequestSchema, params);
|
|
95
|
+
return await this.client.getOrderBook(request);
|
|
96
|
+
}, 'getOrderBook');
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Stream real-time price updates
|
|
100
|
+
*/
|
|
101
|
+
streamPrices(params) {
|
|
102
|
+
const request = create(StreamPricesRequestSchema, params);
|
|
103
|
+
return this.client.streamPrices(request);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get calculated pivot points
|
|
107
|
+
*/
|
|
108
|
+
async getPivotPoints(params) {
|
|
109
|
+
return await this.wrapCall(async () => {
|
|
110
|
+
const request = create(GetPivotPointsRequestSchema, params);
|
|
111
|
+
return await this.client.getPivotPoints(request);
|
|
112
|
+
}, 'getPivotPoints');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=pricing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,gEAAgE;AAChE,cAAc,0CAA0C,CAAC;AAEzD,OAAO,EACL,cAAc,EAMd,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,SAAS,eAAe,CAAC,IAAU;IACjC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;IAChD,OAAO,MAAM,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YACE,OAAe,EACR,IAAa,EACb,OAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAS;QACb,YAAO,GAAP,OAAO,CAAM;QAGpB,IAA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;QACC,MAAM,OAAO,GAAG,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,MAIpB;QACC,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;YACpC,MAAM,OAAO,GAAG,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;YAC5D,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file proto/silvana/news/v1/news.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_proto_silvana_news_v1_news: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* News article source information
|
|
10
|
+
*
|
|
11
|
+
* @generated from message silvana.news.v1.Source
|
|
12
|
+
*/
|
|
13
|
+
export type Source = Message<"silvana.news.v1.Source"> & {
|
|
14
|
+
/**
|
|
15
|
+
* @generated from field: optional string id = 1;
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @generated from field: string name = 2;
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Describes the message silvana.news.v1.Source.
|
|
25
|
+
* Use `create(SourceSchema)` to create a new message.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SourceSchema: GenMessage<Source>;
|
|
28
|
+
/**
|
|
29
|
+
* News article
|
|
30
|
+
*
|
|
31
|
+
* @generated from message silvana.news.v1.NewsArticle
|
|
32
|
+
*/
|
|
33
|
+
export type NewsArticle = Message<"silvana.news.v1.NewsArticle"> & {
|
|
34
|
+
/**
|
|
35
|
+
* @generated from field: silvana.news.v1.Source source = 1;
|
|
36
|
+
*/
|
|
37
|
+
source?: Source;
|
|
38
|
+
/**
|
|
39
|
+
* @generated from field: optional string author = 2;
|
|
40
|
+
*/
|
|
41
|
+
author?: string;
|
|
42
|
+
/**
|
|
43
|
+
* @generated from field: string title = 3;
|
|
44
|
+
*/
|
|
45
|
+
title: string;
|
|
46
|
+
/**
|
|
47
|
+
* @generated from field: optional string description = 4;
|
|
48
|
+
*/
|
|
49
|
+
description?: string;
|
|
50
|
+
/**
|
|
51
|
+
* @generated from field: string url = 5;
|
|
52
|
+
*/
|
|
53
|
+
url: string;
|
|
54
|
+
/**
|
|
55
|
+
* @generated from field: optional string url_to_image = 6;
|
|
56
|
+
*/
|
|
57
|
+
urlToImage?: string;
|
|
58
|
+
/**
|
|
59
|
+
* @generated from field: google.protobuf.Timestamp published_at = 7;
|
|
60
|
+
*/
|
|
61
|
+
publishedAt?: Timestamp;
|
|
62
|
+
/**
|
|
63
|
+
* @generated from field: optional string content = 8;
|
|
64
|
+
*/
|
|
65
|
+
content?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Total text size (title + description + content)
|
|
68
|
+
*
|
|
69
|
+
* @generated from field: int32 text_size = 9;
|
|
70
|
+
*/
|
|
71
|
+
textSize: number;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Describes the message silvana.news.v1.NewsArticle.
|
|
75
|
+
* Use `create(NewsArticleSchema)` to create a new message.
|
|
76
|
+
*/
|
|
77
|
+
export declare const NewsArticleSchema: GenMessage<NewsArticle>;
|
|
78
|
+
/**
|
|
79
|
+
* Request for news articles
|
|
80
|
+
*
|
|
81
|
+
* @generated from message silvana.news.v1.GetNewsRequest
|
|
82
|
+
*/
|
|
83
|
+
export type GetNewsRequest = Message<"silvana.news.v1.GetNewsRequest"> & {
|
|
84
|
+
/**
|
|
85
|
+
* Cryptocurrency tokens to fetch news for (e.g., "btc", "eth", "mina")
|
|
86
|
+
* If empty, fetches news for default tokens (btc, eth, mina)
|
|
87
|
+
*
|
|
88
|
+
* @generated from field: repeated string tokens = 1;
|
|
89
|
+
*/
|
|
90
|
+
tokens: string[];
|
|
91
|
+
/**
|
|
92
|
+
* Maximum number of articles per token
|
|
93
|
+
*
|
|
94
|
+
* Default: 5
|
|
95
|
+
*
|
|
96
|
+
* @generated from field: optional int32 limit = 2;
|
|
97
|
+
*/
|
|
98
|
+
limit?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Filter by language (e.g., "en")
|
|
101
|
+
*
|
|
102
|
+
* Default: "en"
|
|
103
|
+
*
|
|
104
|
+
* @generated from field: optional string language = 3;
|
|
105
|
+
*/
|
|
106
|
+
language?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Time window in hours (e.g., 48 for last 48 hours)
|
|
109
|
+
*
|
|
110
|
+
* Default: 48
|
|
111
|
+
*
|
|
112
|
+
* @generated from field: optional int32 hours = 4;
|
|
113
|
+
*/
|
|
114
|
+
hours?: number;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Describes the message silvana.news.v1.GetNewsRequest.
|
|
118
|
+
* Use `create(GetNewsRequestSchema)` to create a new message.
|
|
119
|
+
*/
|
|
120
|
+
export declare const GetNewsRequestSchema: GenMessage<GetNewsRequest>;
|
|
121
|
+
/**
|
|
122
|
+
* Response containing news articles
|
|
123
|
+
*
|
|
124
|
+
* @generated from message silvana.news.v1.GetNewsResponse
|
|
125
|
+
*/
|
|
126
|
+
export type GetNewsResponse = Message<"silvana.news.v1.GetNewsResponse"> & {
|
|
127
|
+
/**
|
|
128
|
+
* @generated from field: bool success = 1;
|
|
129
|
+
*/
|
|
130
|
+
success: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* @generated from field: string message = 2;
|
|
133
|
+
*/
|
|
134
|
+
message: string;
|
|
135
|
+
/**
|
|
136
|
+
* News results grouped by token
|
|
137
|
+
*
|
|
138
|
+
* @generated from field: repeated silvana.news.v1.TokenNews token_news = 3;
|
|
139
|
+
*/
|
|
140
|
+
tokenNews: TokenNews[];
|
|
141
|
+
/**
|
|
142
|
+
* Indicates if results were served from cache
|
|
143
|
+
*
|
|
144
|
+
* @generated from field: bool from_cache = 4;
|
|
145
|
+
*/
|
|
146
|
+
fromCache: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Cache expiration time (if from_cache = true)
|
|
149
|
+
*
|
|
150
|
+
* @generated from field: optional google.protobuf.Timestamp cache_expires_at = 5;
|
|
151
|
+
*/
|
|
152
|
+
cacheExpiresAt?: Timestamp;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Describes the message silvana.news.v1.GetNewsResponse.
|
|
156
|
+
* Use `create(GetNewsResponseSchema)` to create a new message.
|
|
157
|
+
*/
|
|
158
|
+
export declare const GetNewsResponseSchema: GenMessage<GetNewsResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* News articles for a specific token
|
|
161
|
+
*
|
|
162
|
+
* @generated from message silvana.news.v1.TokenNews
|
|
163
|
+
*/
|
|
164
|
+
export type TokenNews = Message<"silvana.news.v1.TokenNews"> & {
|
|
165
|
+
/**
|
|
166
|
+
* e.g., "btc", "eth", "mina"
|
|
167
|
+
*
|
|
168
|
+
* @generated from field: string token = 1;
|
|
169
|
+
*/
|
|
170
|
+
token: string;
|
|
171
|
+
/**
|
|
172
|
+
* Search query used (e.g., "bitcoin", "ethereum")
|
|
173
|
+
*
|
|
174
|
+
* @generated from field: string query = 2;
|
|
175
|
+
*/
|
|
176
|
+
query: string;
|
|
177
|
+
/**
|
|
178
|
+
* @generated from field: int32 total_results = 3;
|
|
179
|
+
*/
|
|
180
|
+
totalResults: number;
|
|
181
|
+
/**
|
|
182
|
+
* @generated from field: repeated silvana.news.v1.NewsArticle articles = 4;
|
|
183
|
+
*/
|
|
184
|
+
articles: NewsArticle[];
|
|
185
|
+
/**
|
|
186
|
+
* @generated from field: google.protobuf.Timestamp fetched_at = 5;
|
|
187
|
+
*/
|
|
188
|
+
fetchedAt?: Timestamp;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Describes the message silvana.news.v1.TokenNews.
|
|
192
|
+
* Use `create(TokenNewsSchema)` to create a new message.
|
|
193
|
+
*/
|
|
194
|
+
export declare const TokenNewsSchema: GenMessage<TokenNews>;
|
|
195
|
+
/**
|
|
196
|
+
* Request for streaming news updates
|
|
197
|
+
*
|
|
198
|
+
* @generated from message silvana.news.v1.StreamNewsRequest
|
|
199
|
+
*/
|
|
200
|
+
export type StreamNewsRequest = Message<"silvana.news.v1.StreamNewsRequest"> & {
|
|
201
|
+
/**
|
|
202
|
+
* Cryptocurrency tokens to stream news for
|
|
203
|
+
*
|
|
204
|
+
* @generated from field: repeated string tokens = 1;
|
|
205
|
+
*/
|
|
206
|
+
tokens: string[];
|
|
207
|
+
/**
|
|
208
|
+
* Minimum time between updates in seconds
|
|
209
|
+
*
|
|
210
|
+
* Default: 300 (5 minutes)
|
|
211
|
+
*
|
|
212
|
+
* @generated from field: optional int32 update_interval = 2;
|
|
213
|
+
*/
|
|
214
|
+
updateInterval?: number;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Describes the message silvana.news.v1.StreamNewsRequest.
|
|
218
|
+
* Use `create(StreamNewsRequestSchema)` to create a new message.
|
|
219
|
+
*/
|
|
220
|
+
export declare const StreamNewsRequestSchema: GenMessage<StreamNewsRequest>;
|
|
221
|
+
/**
|
|
222
|
+
* @generated from service silvana.news.v1.NewsService
|
|
223
|
+
*/
|
|
224
|
+
export declare const NewsService: GenService<{
|
|
225
|
+
/**
|
|
226
|
+
* Get news articles for specific cryptocurrencies
|
|
227
|
+
*
|
|
228
|
+
* @generated from rpc silvana.news.v1.NewsService.GetNews
|
|
229
|
+
*/
|
|
230
|
+
getNews: {
|
|
231
|
+
methodKind: "unary";
|
|
232
|
+
input: typeof GetNewsRequestSchema;
|
|
233
|
+
output: typeof GetNewsResponseSchema;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Stream real-time news updates (optional future enhancement)
|
|
237
|
+
*
|
|
238
|
+
* @generated from rpc silvana.news.v1.NewsService.StreamNews
|
|
239
|
+
*/
|
|
240
|
+
streamNews: {
|
|
241
|
+
methodKind: "server_streaming";
|
|
242
|
+
input: typeof StreamNewsRequestSchema;
|
|
243
|
+
output: typeof NewsArticleSchema;
|
|
244
|
+
};
|
|
245
|
+
}>;
|