@barchart/portfolio-client-js 10.2.0 → 10.3.1
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/lib/gateway/PortfolioGateway.js +43 -0
- package/lib/index.js +1 -1
- package/package.json +2 -2
|
@@ -108,6 +108,25 @@ module.exports = (() => {
|
|
|
108
108
|
|
|
109
109
|
const protocolType = Enum.fromCode(ProtocolType, protocol.toUpperCase());
|
|
110
110
|
|
|
111
|
+
this._readInstrumentEndpoint = EndpointBuilder.for('read-instrument', 'read instrument')
|
|
112
|
+
.withVerb(VerbType.GET)
|
|
113
|
+
.withProtocol(protocolType)
|
|
114
|
+
.withHost(host)
|
|
115
|
+
.withPort(port)
|
|
116
|
+
.withPathBuilder((pb) => {
|
|
117
|
+
pb.withLiteralParameter('version', REST_API_VERSION)
|
|
118
|
+
.withLiteralParameter('instruments', 'instruments')
|
|
119
|
+
.withVariableParameter('symbol', 'symbol', 'symbol', false);
|
|
120
|
+
})
|
|
121
|
+
.withQueryBuilder((qb) => {
|
|
122
|
+
qb.withVariableParameter('day', 'day', 'day', true, x => x.format());
|
|
123
|
+
})
|
|
124
|
+
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
125
|
+
.withRequestInterceptor(requestInterceptor)
|
|
126
|
+
.withResponseInterceptor(responseInterceptorForDeserialization)
|
|
127
|
+
.withErrorInterceptor(errorInterceptor)
|
|
128
|
+
.endpoint;
|
|
129
|
+
|
|
111
130
|
this._readPortfoliosEndpoint = EndpointBuilder.for('read-portfolios', 'read portfolios')
|
|
112
131
|
.withVerb(VerbType.GET)
|
|
113
132
|
.withProtocol(protocolType)
|
|
@@ -712,6 +731,30 @@ module.exports = (() => {
|
|
|
712
731
|
return this._startPromise;
|
|
713
732
|
}
|
|
714
733
|
|
|
734
|
+
/**
|
|
735
|
+
* Resolves an instrument.
|
|
736
|
+
*
|
|
737
|
+
* @public
|
|
738
|
+
* @async
|
|
739
|
+
* @param {String} symbol - The symbol used to resolve the instrument.
|
|
740
|
+
* @param {Day=} day - The day used for symbol resolution.
|
|
741
|
+
* @returns {Promise<Object>}
|
|
742
|
+
*/
|
|
743
|
+
async readInstrument(symbol, day) {
|
|
744
|
+
checkStart.call(this);
|
|
745
|
+
|
|
746
|
+
assert.argumentIsRequired(symbol, 'symbol', String);
|
|
747
|
+
assert.argumentIsOptional(day, 'day', Day, 'Day');
|
|
748
|
+
|
|
749
|
+
const payload = { symbol };
|
|
750
|
+
|
|
751
|
+
if (day) {
|
|
752
|
+
payload.day = day;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return Gateway.invoke(this._readInstrumentEndpoint, payload);
|
|
756
|
+
}
|
|
757
|
+
|
|
715
758
|
/**
|
|
716
759
|
* Creates a new portfolio for the current user.
|
|
717
760
|
*
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barchart/portfolio-client-js",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.1",
|
|
4
4
|
"description": "JavaScript SDK for Barchart's Portfolio Service",
|
|
5
5
|
"homepage": "https://docs.barchart.com/portfolio/#/",
|
|
6
6
|
"author": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@barchart/common-js": "^4.70.0",
|
|
32
|
-
"@barchart/portfolio-api-common": "^7.0
|
|
32
|
+
"@barchart/portfolio-api-common": "^7.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/core": "^7.11.1",
|