This file contains hidden or 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
| async function checkBlocks(start, end) { | |
| for (let i = start; i < end; i++) { | |
| let block = await web3.eth.getBlock(i) | |
| console.log(`[*] Searching block ${ i }`) | |
| if (block && block.transactions) { | |
| for (let txHash of block.transactions) { | |
| let tx = await web3.eth.getTransaction(txHash) | |
| if (account === tx.to.toLowerCase()) { | |
| console.log(`[+] Transaction found on block ${ lastBlockNumber }`) | |
| console.log({ address: tx.from, value: web3.utils.fromWei(tx.value, 'ether'), timestamp: new Date() }) |
This file contains hidden or 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
| 'use strict' | |
| const Web3 = require('web3') | |
| const BuildTransactionChecker = require('./transactionChecker') | |
| const CreateClient = require('./ethClient') | |
| const web3 = CreateClient(Web3) | |
| const checkBlock = BuildTransactionChecker(web3) |
This file contains hidden or 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
| { | |
| blockHash: '0xf881a143bde4964ccb4aad25c25ea0cfc49ea92d5cc4aab21a1d32a7b3c6a208', | |
| blockNumber: 5482197, | |
| from: '0x70432FE7B0D1130DA2e3c22Be4FB7F2ECc2883B3', | |
| gas: 5000000, | |
| gasPrice: '1000000000', | |
| hash: '0x4ff7862abe6c0bc67c67c1c9551e8710279e138ab9b5e5f5b22b0c2074f595e8', | |
| input: '0x0bc757e0000000000000000000000000000000000000000000000000', | |
| nonce: 111934, | |
| r: '0x2b55ad93866e91db2dfae93aee5ff35fb915530f0b2d30851ac814617847a09a', |
This file contains hidden or 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
| { | |
| difficulty: '2', | |
| gasLimit: 10000000, | |
| gasUsed: 717165, | |
| hash: '0xefc05b503b822c2eeafe4cad047a6aa1587e265ed19a98a1879a3be92ab1a3fb', | |
| miner: '0x0000000000000000000000000000000000000000', | |
| nonce: '0x0000000000000000', | |
| number: 5482184, | |
| parentHash: '0xa24520a2a06ba6109f047d21adc005fdcd958e6387ae131f7aa759f34e050d7b', | |
| receiptsRoot: '0x1415c72a4b0445f43ef4e3842041678fc892aaa400dbe81d590fd26b67ccf299', |
This file contains hidden or 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
| 'use strict' | |
| module.exports = web3 => { | |
| const account = 'YOUR_ETH_ADDRESS'.toLowerCase() | |
| return async function checkLastBlock() { | |
| let block = await web3.eth.getBlock('latest') | |
| console.log(`[*] Searching block ${ block.number }...`) | |
| if (block && block.transactions) { | |
| for (let txHash of block.transactions) { |
This file contains hidden or 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
| 'use strict' | |
| module.exports = Web3 => { | |
| const provider = new Web3.providers.HttpProvider('https://rinkeby.infura.io/v3/YOUR_INFURA_API_KEY_HERE') | |
| return new Web3(provider) | |
| } |
This file contains hidden or 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 Web3 = require('web3'); | |
| class TransactionChecker { | |
| web3; | |
| web3ws; | |
| account; | |
| subscription; | |
| constructor(projectId, account) { | |
| this.web3ws = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws/v3/' + projectId)); |
This file contains hidden or 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 Web3 = require('web3'); | |
| class TransactionChecker { | |
| web3; | |
| account; | |
| constructor(projectId, account) { | |
| this.web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io/v3/' + projectId)); | |
| this.account = account.toLowerCase(); | |
| } |
This file contains hidden or 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
| if __name__ == "__main__": | |
| run_algorithm( | |
| capital_base = 1000, | |
| data_frequency = "minute", | |
| initialize = initialize, | |
| handle_data = handle_data, | |
| analyze = analyze, | |
| exchange_name = "bitfinex", | |
| algo_namespace = NAMESPACE, | |
| base_currency= "usd", |
This file contains hidden or 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 handle_data(context, data): | |
| RSI_periods = 14 | |
| context.i += 1 | |
| if context.i < RSI_periods: | |
| return | |
| RSI_data = data.history(context.asset, | |
| "price", |