@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.mjs
CHANGED
|
@@ -1608,22 +1608,22 @@ var PerpCityContext = class {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
const markTimeSeries = perpResponse.perpSnapshots.map((snapshot) => ({
|
|
1610
1610
|
timestamp: Number(snapshot.timestamp),
|
|
1611
|
-
value: Number(
|
|
1611
|
+
value: Number(snapshot.markPrice)
|
|
1612
1612
|
}));
|
|
1613
1613
|
const indexTimeSeries = beaconResponse.beaconSnapshots.map((snapshot) => ({
|
|
1614
1614
|
timestamp: Number(snapshot.timestamp),
|
|
1615
|
-
value: Number(
|
|
1615
|
+
value: Number(snapshot.indexPrice)
|
|
1616
1616
|
}));
|
|
1617
1617
|
const openInterestTimeSeries = perpResponse.perpSnapshots.map((snapshot) => ({
|
|
1618
1618
|
timestamp: Number(snapshot.timestamp),
|
|
1619
1619
|
value: {
|
|
1620
|
-
takerLongNotional: Number(
|
|
1621
|
-
takerShortNotional: Number(
|
|
1620
|
+
takerLongNotional: Number(snapshot.takerLongNotional),
|
|
1621
|
+
takerShortNotional: Number(snapshot.takerShortNotional)
|
|
1622
1622
|
}
|
|
1623
1623
|
}));
|
|
1624
1624
|
const fundingRateTimeSeries = perpResponse.perpSnapshots.map((snapshot) => ({
|
|
1625
1625
|
timestamp: Number(snapshot.timestamp),
|
|
1626
|
-
value: Number(
|
|
1626
|
+
value: Number(snapshot.fundingRate)
|
|
1627
1627
|
}));
|
|
1628
1628
|
const latestSnapshot = perpResponse.perpSnapshots[perpResponse.perpSnapshots.length - 1];
|
|
1629
1629
|
const latestBeaconSnapshot = beaconResponse.beaconSnapshots[beaconResponse.beaconSnapshots.length - 1];
|
|
@@ -1631,16 +1631,16 @@ var PerpCityContext = class {
|
|
|
1631
1631
|
id: perpId,
|
|
1632
1632
|
tickSpacing: contractData.tickSpacing,
|
|
1633
1633
|
mark: sqrtPriceX96ToPrice(contractData.sqrtPriceX96),
|
|
1634
|
-
index: Number(
|
|
1634
|
+
index: Number(latestBeaconSnapshot.indexPrice),
|
|
1635
1635
|
beacon: perpResponse.perp.beacon.id,
|
|
1636
1636
|
lastIndexUpdate: Number(latestBeaconSnapshot.timestamp),
|
|
1637
1637
|
openInterest: {
|
|
1638
|
-
takerLongNotional: Number(
|
|
1639
|
-
takerShortNotional: Number(
|
|
1638
|
+
takerLongNotional: Number(latestSnapshot.takerLongNotional),
|
|
1639
|
+
takerShortNotional: Number(latestSnapshot.takerShortNotional)
|
|
1640
1640
|
},
|
|
1641
1641
|
markTimeSeries,
|
|
1642
1642
|
indexTimeSeries,
|
|
1643
|
-
fundingRate: Number(
|
|
1643
|
+
fundingRate: Number(latestSnapshot.fundingRate),
|
|
1644
1644
|
bounds: contractData.bounds,
|
|
1645
1645
|
fees: contractData.fees,
|
|
1646
1646
|
openInterestTimeSeries,
|
|
@@ -1800,22 +1800,22 @@ var PerpCityContext = class {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
const markTimeSeries = snapshots.map((snapshot) => ({
|
|
1802
1802
|
timestamp: Number(snapshot.timestamp),
|
|
1803
|
-
value: Number(
|
|
1803
|
+
value: Number(snapshot.markPrice)
|
|
1804
1804
|
}));
|
|
1805
1805
|
const indexTimeSeries = beaconSnapshots.map((snapshot) => ({
|
|
1806
1806
|
timestamp: Number(snapshot.timestamp),
|
|
1807
|
-
value: Number(
|
|
1807
|
+
value: Number(snapshot.indexPrice)
|
|
1808
1808
|
}));
|
|
1809
1809
|
const openInterestTimeSeries = snapshots.map((snapshot) => ({
|
|
1810
1810
|
timestamp: Number(snapshot.timestamp),
|
|
1811
1811
|
value: {
|
|
1812
|
-
takerLongNotional: Number(
|
|
1813
|
-
takerShortNotional: Number(
|
|
1812
|
+
takerLongNotional: Number(snapshot.takerLongNotional),
|
|
1813
|
+
takerShortNotional: Number(snapshot.takerShortNotional)
|
|
1814
1814
|
}
|
|
1815
1815
|
}));
|
|
1816
1816
|
const fundingRateTimeSeries = snapshots.map((snapshot) => ({
|
|
1817
1817
|
timestamp: Number(snapshot.timestamp),
|
|
1818
|
-
value: Number(
|
|
1818
|
+
value: Number(snapshot.fundingRate)
|
|
1819
1819
|
}));
|
|
1820
1820
|
const latestSnapshot = snapshots[snapshots.length - 1];
|
|
1821
1821
|
const latestBeaconSnapshot = beaconSnapshots[beaconSnapshots.length - 1];
|
|
@@ -1823,16 +1823,16 @@ var PerpCityContext = class {
|
|
|
1823
1823
|
id: perpId,
|
|
1824
1824
|
tickSpacing: contractData.tickSpacing,
|
|
1825
1825
|
mark: sqrtPriceX96ToPrice(contractData.sqrtPriceX96),
|
|
1826
|
-
index: Number(
|
|
1826
|
+
index: Number(latestBeaconSnapshot.indexPrice),
|
|
1827
1827
|
beacon: beaconId,
|
|
1828
1828
|
lastIndexUpdate: Number(latestBeaconSnapshot.timestamp),
|
|
1829
1829
|
openInterest: {
|
|
1830
|
-
takerLongNotional: Number(
|
|
1831
|
-
takerShortNotional: Number(
|
|
1830
|
+
takerLongNotional: Number(latestSnapshot.takerLongNotional),
|
|
1831
|
+
takerShortNotional: Number(latestSnapshot.takerShortNotional)
|
|
1832
1832
|
},
|
|
1833
1833
|
markTimeSeries,
|
|
1834
1834
|
indexTimeSeries,
|
|
1835
|
-
fundingRate: Number(
|
|
1835
|
+
fundingRate: Number(latestSnapshot.fundingRate),
|
|
1836
1836
|
bounds: contractData.bounds,
|
|
1837
1837
|
fees: contractData.fees,
|
|
1838
1838
|
openInterestTimeSeries,
|
|
@@ -1928,7 +1928,7 @@ var PerpCityContext = class {
|
|
|
1928
1928
|
perpId: position.perp.id,
|
|
1929
1929
|
wasMaker: position.wasMaker,
|
|
1930
1930
|
wasLong: position.wasLong,
|
|
1931
|
-
pnlAtClose: Number(
|
|
1931
|
+
pnlAtClose: Number(position.pnlAtClose)
|
|
1932
1932
|
}));
|
|
1933
1933
|
}
|
|
1934
1934
|
async fetchPositionLiveDetailsFromContract(perpId, positionId) {
|