@steerprotocol/strategy-utils 1.1.1 → 1.1.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ### [1.1.2-alpha.1](https://github.com/SteerProtocol/strategy-utils-assemblyscript/compare/v1.1.1...v1.1.2-alpha.1) (2022-08-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * :ambulance: Specific Index for parse prices ([0940640](https://github.com/SteerProtocol/strategy-utils-assemblyscript/commit/09406407c7cb12bca2585976f3269414d9be731b))
7
+
8
+ ### [1.1.1-alpha.1](https://github.com/SteerProtocol/strategy-utils-assemblyscript/compare/v1.1.0...v1.1.1-alpha.1) (2022-07-26)
9
+
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **devops:** :bug: Fix tests ([a2bb4d6](https://github.com/SteerProtocol/strategy-utils-assemblyscript/commit/a2bb4d6bdc5e3dc8bbcf6be6f26c74b8167675a7))
15
+
1
16
  ## [1.1.0](https://github.com/SteerProtocol/strategy-utils-assemblyscript/compare/v1.0.0...v1.1.0) (2022-07-26)
2
17
 
3
18
 
@@ -9,8 +9,14 @@ export class Price {
9
9
  ) {}
10
10
  }
11
11
 
12
- export function parsePrices(_prices: String): Array<Price> {
13
- const prices = _prices;
12
+ /**
13
+ *
14
+ * @param _data data connector data array
15
+ * @param _index index of where the candles are in the array
16
+ * @returns
17
+ */
18
+ export function parsePrices(_data: String, _index: i32): Array<Price> {
19
+ const prices = _data;
14
20
  // Parse an object using the JSON object
15
21
  let jsonObj: JSON.Obj = <JSON.Obj>JSON.parse(prices);
16
22
  const result: Array<Price> = [];
@@ -18,7 +24,7 @@ export function parsePrices(_prices: String): Array<Price> {
18
24
  const data_arr = <JSON.Arr>jsonObj.getArr("data");
19
25
  if (data_arr == null) {throw new Error()};
20
26
  // First and only data result for this strategy is the candles
21
- const val = <JSON.Arr>data_arr._arr[0]
27
+ const val = <JSON.Arr>data_arr._arr[_index]
22
28
  if (val != null) {
23
29
  if (val.isArr) {
24
30
  const pricesArray = (<JSON.Arr>val).valueOf();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerprotocol/strategy-utils",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Strategy utilities library for Steer Protocol strategies",
5
5
  "main": "assembly/index.ts",
6
6
  "types": "assembly/index.ts",