cryptopenpen / cryptotax

Outils pour generer les declarations de cessions d'actifs numérique (cerfa 2086)
3 stars 0 forks source link

Comment lancer le code? #1

Open arbolis opened 3 years ago

arbolis commented 3 years ago

Bonjour, Premièrement merci de mettre ton code public, je n'en ai pas trouvé d'autre qui sont faits pour calculer la plus value à déclarer aux impôts, donc merci énormément.

Deuxièmement, je ne suis pas calé en programmation et je ne suis pas sûr de comment lancer le code. Tu parles de docker, mais il n'apparaît quasiment nulle part dans le code. Du coup, je suis tenté git cloner le repository et de faire tourner le code sur un fichier excel téléchargé à partir de binance, par exemple. Quelle serait la marche à suivre exactement ? Je te remercie...

arbolis commented 3 years ago

OK, j'ai créé une clé api sur Binance, j'ai installé docker-compose et j'ai essayé de lancer le code (après avoir créé un virtual env et avoir installé les libs python).

J'ai essayé la commande : python src/main.py --config config.sample.yaml --exchange BINANCE --boot

Mais j'obtiens l'erreur suivante :

Traceback (most recent call last):
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1706, in _execute_context
    self.dialect.do_execute(
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE `binance_crypto_history` (\n  `id` int(11) NOT NULL AUTO_INCREMEN...' at line 2")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/arbolis/Documents/impots_cryptos/cryptotax-master/src/main.py", line 69, in <module>
    boot_db(config["database"]["database_dialect"], engine)
  File "/home/arbolis/Documents/impots_cryptos/cryptotax-master/src/utils.py", line 99, in boot_db
    conn.execute(step)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1186, in execute
    return self._exec_driver_sql(
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1485, in _exec_driver_sql
    ret = self._execute_context(
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1749, in _execute_context
    self._handle_dbapi_exception(
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1930, in _handle_dbapi_exception
    util.raise_(
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1706, in _execute_context
    self.dialect.do_execute(
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/home/arbolis/Documents/impots_cryptos/impots_test/lib/python3.9/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE `binance_crypto_history` (\n  `id` int(11) NOT NULL AUTO_INCREMEN...' at line 2")
[SQL: 
DROP TABLE IF EXISTS `binance_crypto_history`;
CREATE TABLE `binance_crypto_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operation_datetime` datetime NOT NULL,
  `asset` varchar(256) NOT NULL,
  `amount_asset` float NOT NULL,
  `operation` varchar(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
]
(Background on this error at: http://sqlalche.me/e/14/f405)

Comment pourrais-je régler le problème ?

arbolis commented 3 years ago

La dernière version du code retourne : db_1 | 2021-04-30 13:35:19 3 [Warning] Aborted connection 3 to db: 'tax_reporter_arbolis' user: 'root' host: '172.....' (Got an error reading communication packets)