Skip to content

Commit

Permalink
mainnet update
Browse files Browse the repository at this point in the history
  • Loading branch information
JTraversa committed Jan 30, 2022
1 parent 941c409 commit 946f34f
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 127 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ dmypy.json
# vim files
.swo
.swp
orders/orders.json
18 changes: 9 additions & 9 deletions constants/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Market
UNDERLYING = "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa" # The underlying token address
MATURITY = float(1669957199) # The Swivel market maturity in unix
DECIMALS = float(18) # The decimals of the underlying token
NETWORK_STRING = "rinkeby"
UNDERLYING = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" # The underlying token address
MATURITY = float(1656039600) # The Swivel market maturity in unix
DECIMALS = float(6) # The decimals of the underlying token
NETWORK_STRING = "mainnet"

# Position
AMOUNT = float(10000) # The amount of n/zcTokens to use market-making
UPPER_RATE = float(13) # The highest rate at which to quote
LOWER_RATE = float(9.5) # The lowest rate at which to quote
AMOUNT = float(50000) # The amount of n/zcTokens to use market-making
UPPER_RATE = float(5.5) # The highest rate at which to quote
LOWER_RATE = float(2.75) # The lowest rate at which to quote
NUM_TICKS = int(3) # The number of liquidity ticks to split your amount into (Per side + 1 at market price)
COMPOUND_RATE_LEAN = float(1) # How much your quote should change when Compound’s rate varies (e.g. 1 = 1:1 change in price)
EXPIRY_LENGTH = float(100) # How often orders should be refreshed (in seconds)
EXPIRY_LENGTH = float(600) # How often orders should be refreshed (in seconds)

PUBLIC_KEY = "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C"
PUBLIC_KEY = "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5"
31 changes: 15 additions & 16 deletions helpers/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# the current api-dev exposed for swivel api with a format placeholder
swivel_api_route = 'https://api-dev.swivel.exchange/v2/{}'
kovan_api_route = 'https://api-main.swivel.exchange/v2/{}'
mainnet_api_route = 'https://api-main.swivel.exchange/v2/{}'

# update as needed...
param_keys = ('underlying', 'maturity', 'depth', 'status')
Expand Down Expand Up @@ -54,9 +54,8 @@ def invalidate_order(u, m, n):
params = new_params(underlying=u, maturity=m)
resp = requests.delete(route, params=params, auth=('<____>','<____>'))
return resp.status_code, resp.reason
if n == 42:

route = kovan_api_route.format('orders/{}')
if n == 1:
route = mainnet_api_route.format('orders/{}')
params = new_params(underlying=u, maturity=m)
resp = requests.delete(route, params=params)
return resp.status_code, resp.reason
Expand All @@ -67,9 +66,9 @@ def orderbook(u, m, d, n):
params = new_params(underlying=u, maturity=m, depth=d)
resp = requests.get(swivel_api_route.format('orderbook'), params=params)
return resp.json()
if n == 42:
if n == 1:
params = new_params(underlying=u, maturity=m, depth=d)
resp = requests.get(kovan_api_route.format('orderbook'), params=params)
resp = requests.get(mainnet_api_route.format('orderbook'), params=params)
return resp.json()


Expand All @@ -83,12 +82,12 @@ def markets(n, status=None):
resp = requests.get(swivel_api_route.format('markets'), params=params)
return resp.json()

if n == 42:
if n == 1:
params = None
if status != None:
params = new_params(status=status)

resp = requests.get(kovan_api_route.format('markets'), params=params)
resp = requests.get(mainnet_api_route.format('markets'), params=params)
return resp.json()

def last_trade(u, m, n):
Expand All @@ -97,9 +96,9 @@ def last_trade(u, m, n):
params = new_params(underlying=u, maturity=m, depth=1)
resp = requests.get(swivel_api_route.format('fills'), params=params)
return resp.json()[0]
if n == 42:
if n == 1:
params = new_params(underlying=u, maturity=m, depth=1)
resp = requests.get(kovan_api_route.format('fills'), params=params)
resp = requests.get(mainnet_api_route.format('fills'), params=params)
return resp.json()[0]

def orders(u, m, a, n, status=None):
Expand Down Expand Up @@ -127,8 +126,8 @@ def orders(u, m, a, n, status=None):

resp = requests.get(route, params)
return resp.json()
if n == 42:
route = kovan_api_route.format('users/{}/orders'.format(a))
if n == 1:
route = mainnet_api_route.format('users/{}/orders'.format(a))
params = new_params(underlying=u, maturity=m)

if status !=None:
Expand All @@ -143,8 +142,8 @@ def order(k, n):
route = swivel_api_route.format('orders/{}'.format(k))
resp= requests.get(route)
return resp.json()
if n == 42:
route = kovan_api_route.format('orders/{}'.format(k))
if n == 1:
route = mainnet_api_route.format('orders/{}'.format(k))
resp= requests.get(route)
return resp.json()

Expand All @@ -157,7 +156,7 @@ def limit_order(o, s, n):
if n == 4:
resp = requests.post(swivel_api_route.format('orders'), json={'order': o, 'signature': s})
return resp.status_code, resp.reason
if n == 42:
resp = requests.post(kovan_api_route.format('orders'), json={'order': o, 'signature': s})
if n == 1:
resp = requests.post(mainnet_api_route.format('orders'), json={'order': o, 'signature': s})
return resp.status_code, resp.reason

188 changes: 104 additions & 84 deletions orders/orders.json
Original file line number Diff line number Diff line change
@@ -1,142 +1,162 @@
[
{
"order": {
"key": "0x6696c206ebdcbe0d2967e6e97a283b1f4e088d9b4f8916ca72c70382155618a3",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0x6d637575369809075678b4d6814fad8d01a11b00d54099c6e44702bfb351fc9f",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": true,
"principal": "1248750000000000065536",
"premium": "128825730576725393408",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "6660000000",
"premium": "101500322",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.1031637482095899",
"signature": "0x88ee5557612a3ba758ed129afe031ed546799a29f38b8d7990c4eafd59d99197359632514882936ec9efcb47edb557e599ad8faa8f6953bc31b946b603dfea641b",
"premiumAvailable": "128825730576725393408",
"principalAvailable": "1248750000000000065536",
"sequence": 170880
"price": "0.015240288588588589",
"signature": "0x9b861db160d0a4a5e2938bcade4022e8bc4eb81b3420b6decf2dcb0bed81b389281e03fed59aa7a89cd4e2be3b3bef4302d1b66d50354abe358c2de7c554ed921c",
"premiumAvailable": "101500322",
"principalAvailable": "6660000000",
"sequence": 30341
}
},
{
"order": {
"key": "0x436b55368b2d444a51e55e2923dff5567540a60be9c308823ebc0d2fc518b6ff",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0x05060075b65e0080685862195167797d2184ae62671449b6eea5e1a32960c3eb",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": true,
"principal": "2497500000000000131072",
"premium": "270352589520170156032",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "13319950850",
"premium": "223300238",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.10824928509316122",
"signature": "0x3ff3e0f7f8e6621d6875c10635be1ea1d698cc2d05b2054fa042c878c2472b7232a5403428281a4f7ee2d422f3aa7379e7e401bb404a363d29a0af5977872a6d1c",
"premiumAvailable": "270352589520170156032",
"principalAvailable": "2497500000000000131072",
"sequence": 170881
"price": "0.016764343991554593",
"signature": "0xc54078e54bdea1d8451229eb945f6054a4b247da64e3bd983baf91e125cc7b612a9388ff99362ee1025fe78c943887f2cf922def218d34e5a23f7a9d847efbe31b",
"premiumAvailable": "223300238",
"principalAvailable": "13319950850",
"sequence": 30342
}
},
{
"order": {
"key": "0xd2e2890a6d7b4a8830c924577d94a953744f07f985322c3af39a29e4eccddfcc",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0xfe6c1fd065bb3c5620d8e1ab5940f5131199756dc10a8d606ddbe57947d3b7a1",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": true,
"principal": "4995000000000000262144",
"premium": "566107435773779181568",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "26640000000",
"premium": "487202618",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.11333482197673256",
"signature": "0xb0b05acde37f31c1f5c2591be9f373485527c13af385d188da70e78a7720393b428e698a4bdb3fedc7bdc9de7bfd0fb16607ef00357138f4a563c890feeb0a9e1c",
"premiumAvailable": "566107435773779181568",
"principalAvailable": "4995000000000000262144",
"sequence": 170882
"price": "0.01828838656156156",
"signature": "0x7156a401383f614481b9b99d2a5de511c3375f8b60c8c013665e8540669f50d85d77407b1602743eb998d57899f6e92b7db5ca5bb9d7d13c8809da1dc281a7ad1c",
"premiumAvailable": "487202618",
"principalAvailable": "26640000000",
"sequence": 30343
}
},
{
"order": {
"key": "0x5d4bcc0f62469635bb8d1f76b9609025379c2a83b4087a47918fb1ee8351089d",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0x6bdb9058b9670510a54e80aa33c8f1d47ae0a7f9a1624d571914deada5984e03",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": true,
"principal": "1575116240",
"premium": "19204140",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.01219220493847489",
"signature": "0x7be539df695307f7e02d8ce46b70e6f5d3d3c19c55b33e5c871ebc42ba27b0fa7880a3a48dfcc27340a59123caf108f6fd2324d85ae6c121e578d5935e67b76b1b",
"premiumAvailable": "19204140",
"principalAvailable": "1575116240",
"sequence": 30344
}
},
{
"order": {
"key": "0xe6b5a96d9d33192db74ebad08e2000987b2fc11d0fe896bb0675303b6a629f10",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": false,
"principal": "1248750000000000065536",
"premium": "116124602210005958656",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "5084883760",
"premium": "61996015",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.09299267444244722",
"signature": "0x72071a4834bc5d2231a0a812a20b9b12381bafbb6cbfbd798102336adf3cd6052032700bd3819030490d28c293ec17c2e4bb95e90eb6cb00247f16b17f46279d1b",
"premiumAvailable": "116124602210005958656",
"principalAvailable": "1248750000000000065536",
"sequence": 170883
"price": "0.01219221872635295",
"signature": "0x55fd895caa4797f12bdeb430138d38d3d43abe0f0c0a9948b35d553b5709bcf3079b1df94405b86e77d1712839de089fddbc6c2796bec64f7a2b413d66fe8c8c1b",
"premiumAvailable": "61996015",
"principalAvailable": "5084883760",
"sequence": 30345
}
},
{
"order": {
"key": "0x6255198eccb64ee9cb25afee6c49fb585bee9661f20f091c3b6be01b00a7b65a",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0x7fb6805cc7aaefa6c7ce033257e99d19130661939f2cbdf669189e591f8d63fa",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": false,
"principal": "2497500000000000131072",
"premium": "219548076053292548096",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "13320000000",
"premium": "142100592",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.08790713755887589",
"signature": "0xbcb5ab68384e8a3e839b62f70b2850c71bb9b11e0208b2515ebc700b45ff186c4b3c4ce384c1efb3993c32651dc42d7888ffea3a091c614ba1bb05ad82276ea01c",
"premiumAvailable": "219548076053292548096",
"principalAvailable": "2497500000000000131072",
"sequence": 170884
"price": "0.010668212612612613",
"signature": "0x4b34b7d8b92cf9c1928086e5d1e0a432a68b2d0832fd35132499fda3f64804652e480d9668e235f9e8f0ecfe1d41da0a8fe9b1d03c9559e489a2fef73dbb7c661b",
"premiumAvailable": "142100592",
"principalAvailable": "13320000000",
"sequence": 30346
}
},
{
"order": {
"key": "0x0e21ac8eb7f8af8265db73077db690a615d3c985e8564dc8dcb0fa120786e54f",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0xd980dc6f8ccf1a71984cddd065c3ec6ff617ba089272833e1ce1b1bd7a2aa697",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": false,
"principal": "4995000000000000262144",
"premium": "413693895373146292224",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "26640000000",
"premium": "243601199",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.08282160067530456",
"signature": "0x4af7244c7353088a9981fb4e054f84ad54213ce3c79f344c0e08a4bd778fc4534612995ff3a740ec03dbd7bb30cde193c103ba2878c07a2b3f3e81afbd877e0e1b",
"premiumAvailable": "413693895373146292224",
"principalAvailable": "4995000000000000262144",
"sequence": 170885
"price": "0.009144189151651652",
"signature": "0x668a9ca4acf758e170ad852932b18b0f9712f0ac57656dcc60023d3b0569e3161e09d2b4444349ff08df069462c0afdb46826cb524caabd1cc052627568e75f21c",
"premiumAvailable": "243601199",
"principalAvailable": "26640000000",
"sequence": 30347
}
},
{
"order": {
"key": "0x68a2fbeae78ef187a2bf450faddedbb697ac41c6a0eeabbd74af273dcc4ba36f",
"maker": "0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C",
"underlying": "0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa",
"key": "0x67a9b2a2c73dd2f2ed4f77ba83d29cc2a4feea616b5374a554f549a57880d7f7",
"maker": "0xb42Af00422f53e09FC97C3Af041Ddd0B19E936A5",
"underlying": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"vault": true,
"exit": true,
"principal": "624375000000000032768",
"premium": "61232456250000007168",
"maturity": "1669957199",
"expiry": "1642463976"
"principal": "3330000000",
"premium": "45666183",
"maturity": "1656039600",
"expiry": "1643359254"
},
"meta": {
"price": "0.09807",
"signature": "0x6a790549eaf0d19c5f7c64af023cc4d7ec0ea4e5335b74483c475a712df797ef2c7ae1b897b40b82c851f9d078a64503cb23ddaf74d2a5086a25506dc155fbbe1c",
"premiumAvailable": "61232456250000007168",
"principalAvailable": "624375000000000032768",
"sequence": 170886
"price": "0.013713568468468468",
"signature": "0x673a6c2904ea2067c5eb4cad2ce5b9edd8c07711d4ae69f42699b86689ba8645762939e6621d13ed95fd1f5169da9db71d4c499bae4fc3ef31d72122b18fdebd1c",
"premiumAvailable": "45666183",
"principalAvailable": "3330000000",
"sequence": 30348
}
}
]
Loading

0 comments on commit 946f34f

Please sign in to comment.