Skip to content

Commit f74b466

Browse files
Merge pull request #8 from SteerProtocol/update/f64-misc
Update/f64 misc
2 parents e53277f + 301ce8f commit f74b466

File tree

6 files changed

+28
-66
lines changed

6 files changed

+28
-66
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ To run the testing suite, run:
4444

4545
```yarn test```
4646

47-
For more in depth testing of the strategy and performance try using Steer's backtesting toolkit to simulate realistic conditions.
47+
For more in depth testing of the strategy and performance try using Steer's backtesting toolkit to simulate realistic conditions.

assembly/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { getTickFromPrice, getTickSpacing, renderULMResult } from "@steerprotoco
22
import { parseCandles, Position, console, trailingStop } from "@steerprotocol/strategy-utils/assembly";
33
import { JSON } from "json-as/assembly";
44

5-
let percent: f32 = 0;
5+
let percent: f64 = 0;
66
let poolFee: i32 = 0;
77

88
@serializable
99
class Config {
10-
poolFee: f32 = 0;
10+
poolFee: f64 = 0;
1111
percent: i32 = 0;
1212
}
1313

@@ -24,7 +24,7 @@ export function initialize(config: string): void {
2424
}
2525

2626
// Assign values to memory
27-
percent = f32(configJson.percent);
27+
percent = f64(configJson.percent);
2828
poolFee = i32(configJson.poolFee);
2929
}
3030

@@ -44,8 +44,8 @@ export function execute(_prices: string): string {
4444
const lowerLimit = trailingStop(percent, prices);
4545
const upperLimit = prices[prices.length - 1].close;
4646

47-
const upperTick = closestDivisibleNumber(i32(Math.round(getTickFromPrice(f32(upperLimit)))), getTickSpacing(poolFee), false);
48-
const lowerTick = closestDivisibleNumber(i32(Math.round(getTickFromPrice(f32(lowerLimit)))), getTickSpacing(poolFee), true);
47+
const upperTick = closestDivisibleNumber(i32(Math.round(getTickFromPrice(f64(upperLimit)))), getTickSpacing(poolFee), false);
48+
const lowerTick = closestDivisibleNumber(i32(Math.round(getTickFromPrice(f64(lowerLimit)))), getTickSpacing(poolFee), true);
4949

5050
// Calculate position
5151

@@ -61,7 +61,7 @@ export function config(): string {
6161
"$schema": "http://json-schema.org/draft-07/schema#",
6262
"title": "Strategy Config",
6363
"type": "object",
64-
"parameters": ["OHLC"],
64+
"expectedDataTypes": ["OHLC"],
6565
"properties": {
6666
"percent": {
6767
"type": "number",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"@semantic-release/changelog": "^5.0.1",
2929
"@semantic-release/git": "^9.0.0",
3030
"@steerprotocol/base-strategy": "^0.1.0",
31-
"@steerprotocol/concentrated-liquidity-strategy": "0.2.1",
32-
"@steerprotocol/strategy-utils": "^2.1.7",
31+
"@steerprotocol/concentrated-liquidity-strategy": "0.2.8",
32+
"@steerprotocol/strategy-utils": "^2.2.0",
3333
"as-bignum": "^0.2.23",
3434
"commitizen": "^4.2.4",
3535
"conventional-changelog-conventionalcommits": "^4.6.0",

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("WASM Module", () => {
2727
const parsedResult = JSON.parse(result);
2828
// The result should match the given config
2929
expect(JSON.stringify(parsedResult)).toStrictEqual(
30-
`{\"functionName\":\"tend(uint256,(int24[],int24[],uint16[]),bytes)\",\"typesArray\":[\"uint256\",\"tuple(int24[],int24[],uint16[])\",\"bytes\"],\"valuesArray\":[10000,[[492120],[492720],[100]],\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000ffffffffffffffffffffffffffffffffffffffff\"]}`
30+
`{\"functionName\":\"tend(uint256,(int24[],int24[],uint16[]),bytes)\",\"typesArray\":[\"uint256\",\"tuple(int24[],int24[],uint16[])\",\"bytes\"],\"valuesArray\":[10000,[[492180],[492780],[100]],\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000ffffffffffffffffffffffffffffffffffffffff\"]}`
3131
);
3232
});
3333
});

tests/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const config = `{
44
"$schema": "http://json-schema.org/draft-07/schema#",
55
"title": "Strategy Config",
66
"type": "object",
7-
"parameters": ["OHLC"],
7+
"expectedDataTypes": ["OHLC"],
88
"properties": {
99
"percent": {
1010
"type": "number",

yarn.lock

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
"@jridgewell/gen-mapping" "^0.1.0"
1111
"@jridgewell/trace-mapping" "^0.3.9"
1212

13-
"@assemblyscript/loader@0.19.9":
14-
version "0.19.9"
15-
resolved "https://registry.yarnpkg.com/@assemblyscript/loader/-/loader-0.19.9.tgz#9e290dbf5c164d9a0e397b253347e85e17c64057"
16-
integrity sha512-AL39UxO+LkYDXtxFTyJP1UVJYIgqVHTbwk9BMPZjoiNxPP/kxDP+LmHxkr1Pm6goR1QbnF69mn5NMuiLTde0mA==
17-
1813
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6":
1914
version "7.18.6"
2015
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a"
@@ -1674,58 +1669,45 @@
16741669
typescript "^4.3.5"
16751670
visitor-as "^0.11.4"
16761671

1677-
"@steerprotocol/base-strategy@^0.0.2":
1678-
version "0.0.2"
1679-
resolved "https://registry.yarnpkg.com/@steerprotocol/base-strategy/-/base-strategy-0.0.2.tgz#783722fd92756f54434377eadce29ff499edd675"
1680-
integrity sha512-a/47GcdHC7CYukxOGEnlvIvEPDCrCt0Orwl0hTrAhi22pIaJfHRj/B4eN/iFifB8aJMYhp7DNcWHfaSYm+xiIw==
1681-
dependencies:
1682-
"@assemblyscript/loader" "0.19.9"
1683-
"@babel/preset-typescript" "^7.14.5"
1684-
"@semantic-release/changelog" "^5.0.1"
1685-
"@semantic-release/git" "^9.0.0"
1686-
as-bind "^0.8.0"
1687-
commitizen "^4.2.4"
1688-
conventional-changelog-conventionalcommits "^4.6.0"
1689-
typescript "^4.3.5"
1690-
1691-
"@steerprotocol/concentrated-liquidity-strategy@0.2.1":
1692-
version "0.2.1"
1693-
resolved "https://registry.yarnpkg.com/@steerprotocol/concentrated-liquidity-strategy/-/concentrated-liquidity-strategy-0.2.1.tgz#64d57ac357287b472e39ce7ef8d825f816b6915f"
1694-
integrity sha512-lNFCgenOcjdd3PFzS3cz4Lyn56ugfP2IQznhhuOj0jJNgEjUxZpHfN48CrQ32PXmsG8TbIx1pUHU5ONC3kbp0Q==
1672+
"@steerprotocol/concentrated-liquidity-strategy@0.2.8":
1673+
version "0.2.8"
1674+
resolved "https://registry.yarnpkg.com/@steerprotocol/concentrated-liquidity-strategy/-/concentrated-liquidity-strategy-0.2.8.tgz#58c90862593c761ed0fbf5b7b313e7bb54209494"
1675+
integrity sha512-AAWqb1G0T9EHXIFC+plne5xT3Jcf2brLEMUUERI6zomuvQpSrk9QZ0sw0JoxLTLVIBqqi2+LdYQrAGbwGmxpfg==
16951676
dependencies:
16961677
"@babel/preset-typescript" "^7.14.5"
16971678
"@semantic-release/changelog" "^5.0.1"
16981679
"@semantic-release/git" "^9.0.0"
1680+
"@steerprotocol/app-loader" "^0.1.6"
16991681
"@steerprotocol/base-strategy" "0.1.0"
1700-
"@steerprotocol/strategy-utils" "2.1.0"
1682+
"@steerprotocol/strategy-utils" "2.1.8"
17011683
as-bignum "^0.2.23"
17021684
commitizen "^4.2.4"
17031685
conventional-changelog-conventionalcommits "^4.6.0"
1704-
json-as "^0.5.20"
1686+
json-as "^0.5.36"
17051687
source-map-support "^0.5.21"
17061688
typescript "^4.3.5"
17071689
visitor-as "^0.11.4"
17081690

1709-
"@steerprotocol/strategy-utils@2.1.0":
1710-
version "2.1.0"
1711-
resolved "https://registry.yarnpkg.com/@steerprotocol/strategy-utils/-/strategy-utils-2.1.0.tgz#e9b9c40363986b6c66bb3e7e0807b878e01c9833"
1712-
integrity sha512-LblygBA5GrNtcFGtFD18mAnffPaL0qeGne9ffU3tyAuJT7v5JSzxBqveC3npsAcdgWK/ysDsr9aE39bAMun4hg==
1691+
"@steerprotocol/strategy-utils@2.1.8":
1692+
version "2.1.8"
1693+
resolved "https://registry.yarnpkg.com/@steerprotocol/strategy-utils/-/strategy-utils-2.1.8.tgz#4f9f1f5839bfc24461fb17b24c9dc9d1ef508085"
1694+
integrity sha512-YD5HF8YGVQYyLkN3DOs1gEMMFcvwuzIWL6v+WUhpW/TlUoSJMWlOs3KE5wkuiYRBmkPv6YeZsY3i5oZS2ubKNQ==
17131695
dependencies:
17141696
"@babel/preset-typescript" "^7.14.5"
17151697
"@semantic-release/changelog" "^5.0.1"
17161698
"@semantic-release/git" "^9.0.0"
1717-
"@steerprotocol/base-strategy" "^0.0.2"
1699+
"@steerprotocol/base-strategy" "0.1.0"
17181700
as-bignum "^0.2.23"
17191701
commitizen "^4.2.4"
17201702
conventional-changelog-conventionalcommits "^4.6.0"
17211703
json-as "^0.5.20"
17221704
typescript "^4.3.5"
17231705
visitor-as "^0.11.4"
17241706

1725-
"@steerprotocol/strategy-utils@^2.1.7":
1726-
version "2.1.7"
1727-
resolved "https://registry.yarnpkg.com/@steerprotocol/strategy-utils/-/strategy-utils-2.1.7.tgz#29fe7efe75aed9f925251b3515bd91136f6c04ab"
1728-
integrity sha512-weOub2Xl6C7R/ddXp62dB9uZRn/H6LDQOZYtdMUlSeDLBENzg4AejfLqGEdTYOVJcezrSHgUYE+zByBWkgbb8w==
1707+
"@steerprotocol/strategy-utils@^2.2.0":
1708+
version "2.2.0"
1709+
resolved "https://registry.yarnpkg.com/@steerprotocol/strategy-utils/-/strategy-utils-2.2.0.tgz#7bd577eb4ab10cb5080ab44c7867825fa87875b5"
1710+
integrity sha512-spTSmqv/AuPmYOVa15TLjplBDnnHlb4HhF6X2c40u/6Zv58BxN1Z9+m5SWXFGqMhdZnPcLze6B3HSuMm4awCXw==
17291711
dependencies:
17301712
"@babel/preset-typescript" "^7.14.5"
17311713
"@semantic-release/changelog" "^5.0.1"
@@ -2167,13 +2149,6 @@ as-bignum@^0.2.23:
21672149
resolved "https://registry.yarnpkg.com/as-bignum/-/as-bignum-0.2.23.tgz#626e358721504291d35db4ce5c80693630048ad3"
21682150
integrity sha512-0+GiwHNwyw0lXI+6uzOI6ReNOEsqKihdLJuOYJeqEOfXcIqwtSixLcQ7h9UQaMrroktW/Idmqj2TinpcWTxxJA==
21692151

2170-
as-bind@^0.8.0:
2171-
version "0.8.2"
2172-
resolved "https://registry.yarnpkg.com/as-bind/-/as-bind-0.8.2.tgz#2ab20105e7394800b532fa3879cf57bbaed8378c"
2173-
integrity sha512-Y7WTopfRLODzLLpTgyrf6TMeEbcckF8u7r/eU68PeiKh7yY/YzmjCQiPAJw0F70bge+84nUO5j4No7V4fzdoew==
2174-
dependencies:
2175-
visitor-as "^0.5.0"
2176-
21772152
as-string-sink@^0.5.0, as-string-sink@^0.5.3:
21782153
version "0.5.3"
21792154
resolved "https://registry.yarnpkg.com/as-string-sink/-/as-string-sink-0.5.3.tgz#462392222e01bb4570ee0df685b7f64630fd4f56"
@@ -4802,7 +4777,7 @@ json-as@^0.5.20:
48024777
as-string-sink "^0.5.0"
48034778
as-variant "^0.4.1"
48044779

4805-
json-as@^0.5.21:
4780+
json-as@^0.5.21, json-as@^0.5.36:
48064781
version "0.5.36"
48074782
resolved "https://registry.yarnpkg.com/json-as/-/json-as-0.5.36.tgz#ee253b484f1ab3719c1947e740126e0602da5ef5"
48084783
integrity sha512-/oh/Lp4fWEHtq2K3kMLsTMx0d2ywzZbepgaAHe0Ca9J9bYMEEvbW3PLYo0TgVVkjLhvg24mPbUjGWq/f+PBmZQ==
@@ -7175,11 +7150,6 @@ trim-right@^1.0.1:
71757150
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
71767151
integrity sha512-WZGXGstmCWgeevgTL54hrCuw1dyMQIzWy7ZfqRJfSmJZBwklI15egmQytFP6bPidmw3M8d5yEowl1niq4vmqZw==
71777152

7178-
ts-mixer@^5.1.0:
7179-
version "5.4.1"
7180-
resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-5.4.1.tgz#b90db9ced48531aa17ce9184a2890d1e3c99b1e5"
7181-
integrity sha512-Zo9HgPCtNouDgJ+LGtrzVOjSg8+7WGQktIKLwAfaNrlOK1mWGlz1ejsAF/YqUEqAGjUTeB5fEg8gH9Aui6w9xA==
7182-
71837153
ts-mixer@^6.0.2:
71847154
version "6.0.3"
71857155
resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.3.tgz#69bd50f406ff39daa369885b16c77a6194c7cae6"
@@ -7455,14 +7425,6 @@ visitor-as@^0.11.4:
74557425
lodash.clonedeep "^4.5.0"
74567426
ts-mixer "^6.0.2"
74577427

7458-
visitor-as@^0.5.0:
7459-
version "0.5.0"
7460-
resolved "https://registry.yarnpkg.com/visitor-as/-/visitor-as-0.5.0.tgz#c0911c028df3a31218c9091ffdae172b507d536b"
7461-
integrity sha512-U2P13pa7BAnfj6IEbP4feS1Rci6NT4GlDcwpqkk90u7LGalc5jH9aMuWnxTC8RJJ92iZzDQ8Lea5/OnLDsgzlw==
7462-
dependencies:
7463-
lodash.clonedeep "^4.5.0"
7464-
ts-mixer "^5.1.0"
7465-
74667428
vscode-oniguruma@^1.6.1:
74677429
version "1.7.0"
74687430
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b"

0 commit comments

Comments
 (0)