Code Monkey home page Code Monkey logo

beancount-ethereum-importer's People

Contributors

grostim avatar owodunni avatar xuhcc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

beancount-ethereum-importer's Issues

"Max rate limit reached"

Thanks for publishing this.

I get an error about exceeding the rate limit:

python importers/eth/beancount_ethereum/downloader.py --config=importers/eth/config.json --output-dir=downloads
Traceback (most recent call last):
  File "importers/eth/beancount_ethereum/downloader.py", line 150, in <module>
    main(config, output_dir)
  File "importers/eth/beancount_ethereum/downloader.py", line 132, in main
    transactions += get_erc20_transfers(api_url, api_key, address)
  File "importers/eth/beancount_ethereum/downloader.py", line 106, in get_erc20_transfers
    for item in make_api_request(api_url, api_key, address, 'tokentx'):
  File "importers/eth/beancount_ethereum/downloader.py", line 44, in make_api_request
    raise RuntimeError(response)
RuntimeError: b'{"status":"0","message":"NOTOK","result":"Max rate limit reached"}'

On the etherscan page, it looks like the limit is 5 calls/s

Perhaps we can add a backoff, or hardcode the rate limit. For now I will try a hack with sleep...

bean-identify breaks when using beancount ethereum

The indentify function in the importer class cannot be called.

here is the traceback:

  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/identify.py", line 64, in find_imports
    matched = importer.identify(file)
AttributeError: 'tuple' object has no attribute 'identify'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/bin/bean-identify", line 33, in <module>
    sys.exit(load_entry_point('beancount==2.3.5', 'console_scripts', 'bean-identify')())
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 31, in identify_main
    return trampoline_to_ingest(identify)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 198, in trampoline_to_ingest
    return run_import_script_and_ingest(parser)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 246, in run_import_script_and_ingest
    return ingest(importers_list)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 140, in ingest
    args.command(args, parser, importers_list, abs_downloads, hooks=hooks)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/identify.py", line 100, in run
    return identify(importers_list, files_or_directories)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/identify.py", line 82, in identify
    for filename, importers in find_imports(importers_list, files_or_directories,
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/identify.py", line 69, in find_imports
    importer.name(), exc)
AttributeError: 'tuple' object has no attribute 'name'
[<importers.custom_importers.BinanceImporter object at 0x7f9267dc8850>, <importers.custom_importers.KrakenImporter object at 0x7f9267dc87f0>, <beancount.ingest.importers.csv.Importer object at 0x7f926790b520>, <beancount.ingest.importers.csv.Importer object at 0x7f926790ba60>, (<importers.custom_importers.ETHImporter object at 0x7f926790ba90>,), (<importers.custom_importers.ETHImporter object at 0x7f926790b9d0>,), (<importers.custom_importers.ETHImporter object at 0x7f926790b9a0>,)]
Traceback (most recent call last):
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/identify.py", line 64, in find_imports
    matched = importer.identify(file)
AttributeError: 'tuple' object has no attribute 'identify'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/bin/bean-extract", line 33, in <module>
    sys.exit(load_entry_point('beancount==2.3.5', 'console_scripts', 'bean-extract')())
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 36, in extract_main
    return trampoline_to_ingest(extract)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 198, in trampoline_to_ingest
    return run_import_script_and_ingest(parser)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 246, in run_import_script_and_ingest
    return ingest(importers_list)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/scripts_utils.py", line 140, in ingest
    args.command(args, parser, importers_list, abs_downloads, hooks=hooks)
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/extract.py", line 243, in run
    extract(importers_list, files_or_directories, sys.stdout,
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/extract.py", line 177, in extract
    for filename, importers in identify.find_imports(importer_config,
  File "/home/user/Documents/hamud_group/Accounting/beancount_accounting/venv/lib/python3.10/site-packages/beancount/ingest/identify.py", line 69, in find_imports
    importer.name(), exc)
AttributeError: 'tuple' object has no attribute 'name'

Can i download TX from several API ?

Hi !

I would like to get the TX from several blockchains: Ethereum, Gnosis, Avalanche, etc...

Is it possible to have all API within one config file, something like:

{
    "name": "mainnet",
    "account_map": {
        "0x0000": "Actifs:Crypto:Ethereum"
    },
    "fee_account": "Depenses:Crypto:Frais",
    "income_account": "Income:Fixme",
    "expenses_account": "Expenses:Fixme",
    "block_explorer_api_url": "http://api.etherscan.io/api",
    "block_explorer_api_key": "0000",
    "block_explorer_api_request_delay": 0
},
{
    "name": "avalanche",
    "account_map": {
        "0x000": "Actifs:Crypto:Avalanche"
    },
    "fee_account": "Depenses:Crypto:Frais",
    "income_account": "Income:Fixme",
    "expenses_account": "Expenses:Fixme",
    "block_explorer_api_url": "http://api.snowtrace.io/api",
    "block_explorer_api_key": "0000",
    "block_explorer_api_request_delay": 0
}

get balances for each token from API

Hi!

Have you considered gathering token balance from API ?

With Blockscout it should be pretty straightforward thanks to :
https://blockscout.com/xdai/mainnet/api?module=account&action=tokenlist&address=0x

With etherscan and clones, it should be more work as you need to make one request per token, and we will a dict to list the tokens to be checked.

https://api.etherscan.io/api
   ?module=account
   &action=tokenbalance
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &address=0xe04f27eb70e025b78871a2ad7eabe85e61212761
   &tag=latest&apikey=YourApiKeyToken

I am wondering what would be neatest way to implement that without breaking the current behaviour ?
I was thinking about using the downloader to create a separate json file with the balances, and then a separate importer dedicated to the balance statements.

What do you think ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.