This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.20; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
contract MyToken is ERC721, ERC721URIStorage, ERC721Burnable, Ownable { | |
constructor(address initialOwner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.20; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; | |
contract Marketplace is ReentrancyGuard, Ownable { | |
using Counters for Counters.Counter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity >=0.6.6 <0.8.0; | |
import './utils/SafeMath.sol'; | |
import './UniswapV2Library.sol'; | |
import './interfaces/IERC20.sol'; | |
import './interfaces/IUniswapV2Pair.sol'; | |
import './interfaces/IUniswapV2Factory.sol'; | |
import './interfaces/IUniswapV2Router02.sol'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from backtesting import Strategy | |
from backtesting.lib import crossover | |
def EMA_Backtesting(values, n): | |
""" | |
Return exponential moving average of `values`, at | |
each step taking into account `n` previous values. | |
""" | |
close = pd.Series(values) | |
return talib.EMA(close, timeperiod=n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startArbitrage( | |
address token0, | |
address token1, | |
uint amount0, | |
uint amount1 | |
) external { | |
address pairAddress = IUniswapV2Factory(pancakeFactory).getPair(token0, token1); | |
require(pairAddress != address(0), 'This pool does not exist'); | |
IUniswapV2Pair(pairAddress).swap( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ethers = require('ethers'); | |
const { FlashbotsBundleProvider} = require('@flashbots/ethers-provider-bundle') | |
// Standard json rpc provider directly from ethers.js. For example you can use Infura, Alchemy, or your own node. | |
// This sample uses one of the default provider goerli | |
const provider = new ethers.getDefaultProvider("goerli"); | |
// `authSigner` is an Ethereum private key that does NOT store funds and is NOT your bot's primary key. | |
// This is an identifying key for signing payloads to establish reputation and whitelisting | |
const authSigner = new ethers.Wallet( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import ccxt | |
import calendar | |
from datetime import datetim | |
binance = ccxt.binance() | |
now = datetime.utcnow() | |
unixtime = calendar.timegm(now.utctimetuple()) | |
since = (unixtime - 60*60) * 1000 # UTC timestamp in milliseconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Ichimoku(df): | |
df1 = df.copy() | |
max_9 = df1.high.rolling(window=9).max() | |
min_9 = df1.high.rolling(window=9).min() | |
df1["tenkan"] = (max_9+min_9)/2 | |
df1["base"] = (df1.high.rolling(window=26).max()+df1.high.rolling(window=26).min())/2 | |
xdate = [x.date() for x in df1.index] | |
plt.figure(figsize=(15,5)) | |
plt.grid() | |
plt.plot(xdate, df1.close, color="b", lw=1, linestyle="dotted", label="original") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import uuid | |
import boto3 | |
import tweepy | |
from urllib.parse import unquote_plus | |
# Twitter authentication variables | |
consumer_key = os.environ.get('TWITTER_CONSUMER_KEY', 'ap-northeast-1') | |
consumer_secret = os.environ.get('TWITTER_CONSUMER_SECRET', 'ap-northeast-1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @notice Calculate how much profit we can by arbitraging between two pools | |
function getProfit(address pool0, address pool1, address adjustedpair, address adjustedtoken, uint256 adjustment0, uint256 adjustment1) external view returns (uint256 profit, address baseToken) { | |
(bool baseTokenSmaller, , ) = isbaseTokenSmaller(pool0, pool1); | |
baseToken = baseTokenSmaller ? IUniswapV2Pair(pool0).token0() : IUniswapV2Pair(pool0).token1(); | |
Adjustments memory adj; | |
adj.adjustmentPool = adjustedpair; | |
adj.adjustmentToken = adjustedtoken; | |
adj.adjustment0 = adjustment0; | |
adj.adjustment1 = adjustment1; |
NewerOlder