@barchart/portfolio-client-js 10.2.0 → 10.3.0

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.
@@ -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
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtProvider: JwtProvider,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '10.2.0'
10
+ version: '10.3.0'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "JavaScript SDK for Barchart's Portfolio Service",
5
5
  "homepage": "https://docs.barchart.com/portfolio/#/",
6
6
  "author": {