@equitysim/trkd-client
Advanced tools
Comparing version 0.2.3 to 0.2.4
{ | ||
"name": "@equitysim/trkd-client", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "REST Client for TRKD API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -127,3 +127,3 @@ export default { | ||
PUTCALLIND: { | ||
type: Number, | ||
type: String, | ||
name: 'optionType', | ||
@@ -130,0 +130,0 @@ }, |
@@ -25,3 +25,3 @@ import searchFields from './field-maps/search-fields' | ||
const result = [] | ||
const items = trkdBody['Result']['Hit'] | ||
const items = trkdBody['Result'] ? trkdBody['Result']['Hit'] : [] | ||
for (const item of items) { | ||
@@ -40,3 +40,3 @@ result.push(formatSearchItem(item)) | ||
docs: formatSearchItems(trkdResponse['GetDerivativeQuote_Response_1']), | ||
...formatSearchHeader(trkdResponse['GetDerivativeQuote_Response_1'], header) | ||
...formatSearchHeader(trkdResponse['GetDerivativeQuote_Response_1'], header), | ||
}) | ||
@@ -46,3 +46,3 @@ | ||
docs: formatSearchItems(trkdResponse['GetEquityQuote_Response_1']), | ||
... formatSearchHeader(trkdResponse['GetEquityQuote_Response_1'], header) | ||
...formatSearchHeader(trkdResponse['GetEquityQuote_Response_1'], header), | ||
}) | ||
@@ -52,3 +52,3 @@ | ||
docs: formatSearchItems(trkdResponse['GetFundQuote_Response_1']), | ||
...formatSearchHeader(trkdResponse['GetEquityQuote_Response_1'], header) | ||
...formatSearchHeader(trkdResponse['GetEquityQuote_Response_1'], header), | ||
}) | ||
@@ -58,3 +58,3 @@ | ||
docs: formatSearchItems(trkdResponse['GetGovCorpInst_Response_1']), | ||
...formatSearchHeader(trkdResponse['GetGovCorpInst_Response_1'], header) | ||
...formatSearchHeader(trkdResponse['GetGovCorpInst_Response_1'], header), | ||
}) | ||
@@ -64,9 +64,15 @@ | ||
const limit = header['MaxCount'] | ||
const responseHeader = trkdBody['ResultHeader'] | ||
return { | ||
page: Math.floor(responseHeader['FirstHit'] / limit) + 1, | ||
pages: Math.ceil(responseHeader['TotalHits'] / limit), | ||
const result = { | ||
page: 1, | ||
pages: 0, | ||
limit, | ||
total: responseHeader['TotalHits'], | ||
total: 0, | ||
} | ||
if (trkdBody) { | ||
const responseHeader = trkdBody['ResultHeader'] | ||
result.page = Math.floor(responseHeader['FirstHit'] / limit) + 1 | ||
result.pages = Math.ceil(responseHeader['TotalHits'] / limit) | ||
result.total = responseHeader['TotalHits'] | ||
} | ||
return result | ||
} |
@@ -58,3 +58,2 @@ import { ValidationError } from '../dto/errors' | ||
if (!(startTime instanceof Date) || startTime > new Date()) throw new ValidationError('startTime must be less than now', startTime) | ||
if (!(endTime instanceof Date) || endTime > new Date()) throw new ValidationError('endTime must be less than now', endTime) | ||
if (!intervals.includes(interval)) throw new ValidationError(`interval must be one of the following: ${intervals.toString()}`, interval) | ||
@@ -61,0 +60,0 @@ |
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
41893
1287