Skip to content

Instantly share code, notes, and snippets.

View alexesc's full-sized avatar

Alejandro Escandon alexesc

View GitHub Profile
@alexesc
alexesc / dynamic_spread_and_band_script.py
Created May 26, 2021 00:42 — forked from squarelover/dynamic_spread_and_band_script.py
slightly modified dynamic spread script
from decimal import Decimal
from datetime import datetime
import time
from hummingbot.script.script_base import ScriptBase
from hummingbot.core.event.events import BuyOrderCompletedEvent, SellOrderCompletedEvent
from os.path import realpath, join
s_decimal_1 = Decimal("1")
LOGS_PATH = realpath(join(__file__, "../../logs/"))

Keybase proof

I hereby claim:

  • I am alexesc on github.
  • I am aramisesc (https://keybase.io/aramisesc) on keybase.
  • I have a public key ASDLA7euhV1VdaBPOalQyZPEmdkoAmHlaM3qAfQtgDuOLgo

To claim this, I am signing this object:

@alexesc
alexesc / gist:5ba372cc9c1cc2b2217a7ee185634347
Created July 18, 2019 13:28
smart asset interval trading RIDE
let startHeight = 10000
let interval = 44000
let limit = 1500
match tx {
case t: TransferTransaction | MassTransferTransaction | ExchangeTransaction =>
(height - startHeight) % interval < limit
case _ => true
}
@alexesc
alexesc / gist:ce7fb904de866ad9e92a75c18b36d889
Created July 18, 2019 01:21
smart asset fix price increase RIDE
let startPrice = 10
let startHeight = 1000
let interval = 1000
#porciento en el que aumenta el precio en cada paso
let raise = 5
match tx {
case t: TransferTransaction | MassTransferTransaction => false
case e: ExchangeTransaction =>
e.price == startPrice + ((height - startHeight) / interval) * (100 + raise) / 100
@alexesc
alexesc / gist:b0cae94fb8fdddcc6b92a3a3572b5240
Last active July 18, 2019 00:37
smart asset Trading with prices from an oracle RIDE
let oracle = Address(base58'3PLNmokt22NrSiNvCLvwMUP84LCMJqbXwAD')
let assetId = toBase58String(base58'oWgJN6YGZFtZrV8BWQ1PGktZikgg7jzGmtm16Ktyvjd')
match tx {
#se prohibe la transferencia del activo
case t: TransferTransaction | MassTransferTransaction => false
case e: ExchangeTransaction =>
#chequeando que el intercambio es a un precio fijado en el estado del oracle para ese activo
let correctPrice = e.price == extract(getInteger(oracle, assetId))
#comprobamos que el intercambio es por WAVES
@alexesc
alexesc / gist:2df6b7ef96d6b6a18e8995a31b19b386
Created July 18, 2019 00:12
smart asset exchange only with selected coin RIDE
let BTCId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS'
match tx {
case t : ExchangeTransaction =>
t.sellOrder.assetPair.priceAsset == BTCId ||
t.sellOrder.assetPair.amountAsset == BTCId
case _ => true
}
@alexesc
alexesc / gist:d476333aa5ee6a11f885d1bf20e555fd
Last active July 18, 2019 00:12
smart asset transfer con permiso del emisor RIDE
match tx {
case t : TransferTransaction =>
let issuer = extract(addressFromString("3P6ms9EotRX8JwSrebeTXYVnzpsGCrKWLv4"))
# chequeamos que el estado del emisor (issuer) contiene el ID de la transacción
isDefined(getInteger(issuer, toBase58String(t.id)))
case _ => false
}
match tx {
case t : TransferTransaction =>
let bannedRecipient1 = addressFromString("3P6ms9EotRX8JwSrebeTXYVnzpsGCrKWLv4")
let bannedRecipient2 = addressFromString("3PLZcCJyYQnfWfzhKXRA4rteCQC9J1ewf5K")
let bannedRecipient3 = addressFromString("3PHrS6VNPRtUD8MHkfkmELavL8JnGtSq5sx")
t.recipient != bannedRecipient1 && t.recipient != bannedRecipient2 && t.recipient != bannedRecipient3
case _ => false
}
match tx {
case t : TransferTransaction =>
let trustedRecipient1 = addressFromString("3P6ms9EotRX8JwSrebeTXYVnzpsGCrKWLv4")
let trustedRecipient2 = addressFromString("3PLZcCJyYQnfWfzhKXRA4rteCQC9J1ewf5K")
let trustedRecipient3 = addressFromString("3PHrS6VNPRtUD8MHkfkmELavL8JnGtSq5sx")
t.recipient == trustedRecipient1 || t.recipient == trustedRecipient2 || t.recipient == trustedRecipient3
case _ => false
}
@alexesc
alexesc / gist:160f4708fabd629df59b26a4d2144c19
Last active July 14, 2019 17:39
code of smart account for option trading RIDE -en
#the account owner pledges to sell a certain number of the asset's units
#at sellPrice between block heights expirationStart and expirationEnd
let expirationStart = 100000
let expirationEnd = 101440
let sellPrice = 10000
let amountAsset = base58'8jfD2JBLe23XtCCSQoTx5eAW5QCU6Mbxi3r78aNQLcNf'
let priceAsset = base58'9jfD2JBLe23XtCCSQoTx5eAW5QCU6Mbxi3r78aNQLcNf'
#option asset ID
let optionsAsset = base58'7jfD2JBLe23XtCCSQoTx5eAW5QCU6Mbxi3r78aNQLcNf'
#extracting the sender's address from the transaction