@strobelabs/perpcity-sdk 0.2.0 → 0.2.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/LICENSE.md +21 -674
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1697,22 +1697,22 @@ var PerpCityContext = class {
|
|
|
1697
1697
|
}
|
|
1698
1698
|
const markTimeSeries = perpResponse.perpSnapshots.map((snapshot) => ({
|
|
1699
1699
|
timestamp: Number(snapshot.timestamp),
|
|
1700
|
-
value: Number(
|
|
1700
|
+
value: Number(snapshot.markPrice)
|
|
1701
1701
|
}));
|
|
1702
1702
|
const indexTimeSeries = beaconResponse.beaconSnapshots.map((snapshot) => ({
|
|
1703
1703
|
timestamp: Number(snapshot.timestamp),
|
|
1704
|
-
value: Number(
|
|
1704
|
+
value: Number(snapshot.indexPrice)
|
|
1705
1705
|
}));
|
|
1706
1706
|
const openInterestTimeSeries = perpResponse.perpSnapshots.map((snapshot) => ({
|
|
1707
1707
|
timestamp: Number(snapshot.timestamp),
|
|
1708
1708
|
value: {
|
|
1709
|
-
takerLongNotional: Number(
|
|
1710
|
-
takerShortNotional: Number(
|
|
1709
|
+
takerLongNotional: Number(snapshot.takerLongNotional),
|
|
1710
|
+
takerShortNotional: Number(snapshot.takerShortNotional)
|
|
1711
1711
|
}
|
|
1712
1712
|
}));
|
|
1713
1713
|
const fundingRateTimeSeries = perpResponse.perpSnapshots.map((snapshot) => ({
|
|
1714
1714
|
timestamp: Number(snapshot.timestamp),
|
|
1715
|
-
value: Number(
|
|
1715
|
+
value: Number(snapshot.fundingRate)
|
|
1716
1716
|
}));
|
|
1717
1717
|
const latestSnapshot = perpResponse.perpSnapshots[perpResponse.perpSnapshots.length - 1];
|
|
1718
1718
|
const latestBeaconSnapshot = beaconResponse.beaconSnapshots[beaconResponse.beaconSnapshots.length - 1];
|
|
@@ -1720,16 +1720,16 @@ var PerpCityContext = class {
|
|
|
1720
1720
|
id: perpId,
|
|
1721
1721
|
tickSpacing: contractData.tickSpacing,
|
|
1722
1722
|
mark: sqrtPriceX96ToPrice(contractData.sqrtPriceX96),
|
|
1723
|
-
index: Number(
|
|
1723
|
+
index: Number(latestBeaconSnapshot.indexPrice),
|
|
1724
1724
|
beacon: perpResponse.perp.beacon.id,
|
|
1725
1725
|
lastIndexUpdate: Number(latestBeaconSnapshot.timestamp),
|
|
1726
1726
|
openInterest: {
|
|
1727
|
-
takerLongNotional: Number(
|
|
1728
|
-
takerShortNotional: Number(
|
|
1727
|
+
takerLongNotional: Number(latestSnapshot.takerLongNotional),
|
|
1728
|
+
takerShortNotional: Number(latestSnapshot.takerShortNotional)
|
|
1729
1729
|
},
|
|
1730
1730
|
markTimeSeries,
|
|
1731
1731
|
indexTimeSeries,
|
|
1732
|
-
fundingRate: Number(
|
|
1732
|
+
fundingRate: Number(latestSnapshot.fundingRate),
|
|
1733
1733
|
bounds: contractData.bounds,
|
|
1734
1734
|
fees: contractData.fees,
|
|
1735
1735
|
openInterestTimeSeries,
|
|
@@ -1889,22 +1889,22 @@ var PerpCityContext = class {
|
|
|
1889
1889
|
}
|
|
1890
1890
|
const markTimeSeries = snapshots.map((snapshot) => ({
|
|
1891
1891
|
timestamp: Number(snapshot.timestamp),
|
|
1892
|
-
value: Number(
|
|
1892
|
+
value: Number(snapshot.markPrice)
|
|
1893
1893
|
}));
|
|
1894
1894
|
const indexTimeSeries = beaconSnapshots.map((snapshot) => ({
|
|
1895
1895
|
timestamp: Number(snapshot.timestamp),
|
|
1896
|
-
value: Number(
|
|
1896
|
+
value: Number(snapshot.indexPrice)
|
|
1897
1897
|
}));
|
|
1898
1898
|
const openInterestTimeSeries = snapshots.map((snapshot) => ({
|
|
1899
1899
|
timestamp: Number(snapshot.timestamp),
|
|
1900
1900
|
value: {
|
|
1901
|
-
takerLongNotional: Number(
|
|
1902
|
-
takerShortNotional: Number(
|
|
1901
|
+
takerLongNotional: Number(snapshot.takerLongNotional),
|
|
1902
|
+
takerShortNotional: Number(snapshot.takerShortNotional)
|
|
1903
1903
|
}
|
|
1904
1904
|
}));
|
|
1905
1905
|
const fundingRateTimeSeries = snapshots.map((snapshot) => ({
|
|
1906
1906
|
timestamp: Number(snapshot.timestamp),
|
|
1907
|
-
value: Number(
|
|
1907
|
+
value: Number(snapshot.fundingRate)
|
|
1908
1908
|
}));
|
|
1909
1909
|
const latestSnapshot = snapshots[snapshots.length - 1];
|
|
1910
1910
|
const latestBeaconSnapshot = beaconSnapshots[beaconSnapshots.length - 1];
|
|
@@ -1912,16 +1912,16 @@ var PerpCityContext = class {
|
|
|
1912
1912
|
id: perpId,
|
|
1913
1913
|
tickSpacing: contractData.tickSpacing,
|
|
1914
1914
|
mark: sqrtPriceX96ToPrice(contractData.sqrtPriceX96),
|
|
1915
|
-
index: Number(
|
|
1915
|
+
index: Number(latestBeaconSnapshot.indexPrice),
|
|
1916
1916
|
beacon: beaconId,
|
|
1917
1917
|
lastIndexUpdate: Number(latestBeaconSnapshot.timestamp),
|
|
1918
1918
|
openInterest: {
|
|
1919
|
-
takerLongNotional: Number(
|
|
1920
|
-
takerShortNotional: Number(
|
|
1919
|
+
takerLongNotional: Number(latestSnapshot.takerLongNotional),
|
|
1920
|
+
takerShortNotional: Number(latestSnapshot.takerShortNotional)
|
|
1921
1921
|
},
|
|
1922
1922
|
markTimeSeries,
|
|
1923
1923
|
indexTimeSeries,
|
|
1924
|
-
fundingRate: Number(
|
|
1924
|
+
fundingRate: Number(latestSnapshot.fundingRate),
|
|
1925
1925
|
bounds: contractData.bounds,
|
|
1926
1926
|
fees: contractData.fees,
|
|
1927
1927
|
openInterestTimeSeries,
|
|
@@ -2017,7 +2017,7 @@ var PerpCityContext = class {
|
|
|
2017
2017
|
perpId: position.perp.id,
|
|
2018
2018
|
wasMaker: position.wasMaker,
|
|
2019
2019
|
wasLong: position.wasLong,
|
|
2020
|
-
pnlAtClose: Number(
|
|
2020
|
+
pnlAtClose: Number(position.pnlAtClose)
|
|
2021
2021
|
}));
|
|
2022
2022
|
}
|
|
2023
2023
|
async fetchPositionLiveDetailsFromContract(perpId, positionId) {
|