Skip to main content

simple using threading to invest about bitcoin.

Project description

Cointools

Generic badge

  1. Install
-> pip install cointools

  1. import
from cointools.manager import MultipleManager
from cointools.service import BaseServiceHandler
  1. example

1) class MultipleManager

class MyManager(MultipleManager) : 
    def connect(self) : 
        pass 

    def get_ticker(self) : 
        pass

    def finish(self, ticker) :
        pass

    def verify_to_service(self) :
        pass

    def verify_to_ticker(self) : 
        pass


connect(self) -> None

you can connect to the "self._conn" variable through the Bitcoin exchange api you want.

  • exmaple(connect)
    ...
    # self._key : tuple

    def coonnect(self) : 
        self._conn = pyupbit.Upbit(self._key[0], self._key[1])

get_ticker(self) -> str

This function is a custom input function to obtain the desired ticker.

" you can make the black list about using ticker. "

  • example(get_ticker)
    ...
    def get_ticker(self) : 
        return input("Which ticker do you want ?: ")

finish(self, ticker) -> None

This is a function that works after end the thread.

" you can remove ticker in black list. "

  • example(finish)
    ...
    def finish(self, ticker) : 
        pass

verify_to_service(self) -> bool

it is used for functions that require confirmation before service start.

  • example(verify_to_service)
    ...
    def verify_to_service(self) : 
        return True

verify_to_ticker(self) -> bool

it is used to check the ticker after receiving the ticker.

  • example(verify_to_ticker)
    ...
    def verify_to_service(self) : 
        return True

2) class BaseServiceHandler

...
class MyService(BaseServiceHandler) : 
    def setup(self) : 
        pass 

    def action(self) : 
        pass

    def finish(self) : 
        pass
  • value
  • _conn : it's connection of bitcoin exchange API.
  • _ticker : it's ticker in the thread.

setup(self) -> None

This is a function that sets up before the action is executed.

    ...
    def setup(self) : 
        self._price = None

action(self) -> None

This function monitor and action about ticker.

" you use to principle of investment. "

example(full)

from cointools.manager import MultipleManager
from cointools.service import BaseServiceHandler

KEY = ("test key", "test secret)
class MyManager(MultipleManager) : 
    def connect(self) : 
        self._conn = pyupbit.Upbit(self._key[0], self._key[1])

class MyService(BaseServiceHandler) : 
    def action(self) : 
        print(f"{self._ticker} hello!")

    def finish(self) : 
        print(f"{self._ticker} goob bye~")

with MyManager(KEY, MyService) as manager :
    manager.connect()
    manager.start()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cointools-1.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file cointools-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cointools-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for cointools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58ad751ee88c61aa4fb98e6305efbd23ad24a22f408420ddf3e006ff89004257
MD5 592821771916a106452d8823d4e007e0
BLAKE2b-256 8a83fadb5e7b98ace918d0de3f3e713c8682e3f60ef844c9e75241c56bd783e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page