Saravanan666/pypi-org huggingface dataset:
Package: coinstac-dinunet
coinstac-dinunetDistributed Neural Network implementation  on COINSTAC.pip install coinstac-dinunetSpecify supported packages like pytorch & torchvision in a requirements.txt fileHighlights:1. Handles multi-network/complex training schemes.
2. Automatic data splitting/k-fold cross validation.
3. Automatic model checkpointing.
4. GPU enabled local sites.
5. Customizable metrics(w/Auto serialization between nodes) to work with any schemes.
6. We can integrate any custom reduction and learning mechanism by extending coinstac_dinunet.distrib.reducer/learner.
7. Realtime profiling each sites by specifying in compspec file(see dinune_fsv example below for details). 
...Working examples:FreeSurfer volumes classification.VBM 3D images classification.Running an analysisin the coinstac App.Add a new NN computation to COINSTAC (Development guide):importsfromcoinstac_dinunetimportCOINNDataset,COINNTrainer,COINNLocalfromcoinstac_dinunet.metricsimportCOINNAverages,Prf1a1. Define Data LoaderclassMyDataset(COINNDataset):def__init__(self,**kw):super().__init__(**kw)self.labels=Nonedefload_index(self,id,file):data_dir=self.path(id,'data_dir')# data_dir comes from inputspecs.json...self.indices.append([id,file])def__getitem__(self,ix):id,file=self.indices[ix]data_dir=self.path(id,'data_dir')# data_dir comes from inputspecs.jsonlabel_dir=self.path(id,'label_dir')# label_dir comes from inputspecs.json...# Logic to load, transform single data item....return{'inputs':..,'labels':...}2. Define TrainerclassMyTrainer(COINNTrainer):def__init__(self,**kw):super().__init__(**kw)def_init_nn_model(self):self.nn['model']=MYModel(in_size=self.cache['input_size'],out_size=self.cache['num_class'])defiteration(self,batch):inputs,labels=batch['inputs'].to(self.device['gpu']).float(),batch['labels'].to(self.device['gpu']).long()out=F.log_softmax(self.nn['model'](inputs),1)loss=F.nll_loss(out,labels)_,predicted=torch.max(out,1)score=self.new_metrics()score.add(predicted,labels)val=self.new_averages()val.add(loss.item(),len(inputs))return{'out':out,'loss':loss,'averages':val,'metrics':score,'prediction':predicted}3. Add entries to:Local node entry pointCPU,GPUAggregator node pointCPU,GPUcompspec.json fileCPU,GPUAdvanced use cases:Define custom metrics:Extendcoinstac_dinunet.metrics.COINNMetricsExample:coinstac_dinunet.metrics.Prf1afor Precision, Recall, F1, and AccuracyDefinecustom DataHandleDefineCustom Learner/custom Aggregator(Default is Distributed SGD)
Package: coinstacparsers
coinstacparsersThis package includes fsl_parser, vbm_parser and csv parser. fsl_parser parses the freesurfer files (specified in inputspec.json) as dependencies and returns
the covariates (X) and dependent (y) matrices as dataframes. The format of inputspec.json should be as shown in the example inputspec.json here.
Similarly vbm_parser parses NIfTI images as dependencies and returns the covariates (X) and dependent (y) matrices as dataframes.
csv_parser reads the values specified in inputspec.json file and returns the covariates (X) and dependent (y) matrices as dataframes.How to installpip install coinstacparsersHow to runfor fsl parser:import coinstacparsersfrom coinstacparsers import parsersargs = json.loads(sys.stdin.read())(X, y) = parsers.fsl_parser(args)for vbm parser:import coinstacparsersfrom coinstacparsers import parsersargs = json.loads(sys.stdin.read())mask = os.path.join('/computation', mask_directory, mask_file_name)(X, y) = parsers.vbm_parser(args, mask)
for csv parser:import coinstacparsersfrom coinstacparsers import parsersargs = json.loads(sys.stdin.read())(X, y) = parsers.csv_parser(args)
Package: coinstac-pyprofiler
coinstac python profilerProfile your python code (includes code running using coinstac-simulator). This primarily uses pyinstrument profiler, but can also be extended to include other python profilersPrerequisitesPython 3.6+
Other packages listed in Requirements.txtUsageNOTE: The code currently implements profiling based on pyinstrument profiler. Other profilier (such as cprofile) can be included based on requirements.First way:Use the following line above the method definition which needs to be profiled.fromcoinstac_pyprofilerimportcustom_profilerascprof@cprof.profile(type="pyinstrument",output_file_prefix=output_file_prefix)Decorator class to profile any method.
Note: 'output_file_prefix' should include its (absolute) directory pathSecond way:Create object of Profile class in custom_profiler.py and use start() and stop() methods to control profiling.fromcoinstac_pyprofilerimportcustom_profilerascprof@cprof.profile(type="pyinstrument",output_file_prefix=output_file_prefix)profile=cprof.Profile(type='pyinstrument',output_file_prefix=<your_dir_path>/<some_file_prefix>")profile.start()<yourcodetoprofile>profile.stop()profile.persist_log()Merging multiple profile output filesMerges the json profiler output files generated using pyinstrument profiling and saves merged output.Use-case:For a computation in coinstac-simulator, some computation has many iterations and every iteration of python call generates a separate profile json output file. All such json files can be merged separately for each client/remote using this call.ExampleAn example usage is included in tests/examples/profiler_usage.py which demonstrates the usage of the above mentioned profiling methods and also provides examples to merge multiple profile output files.Happy profiling!!
Package: coinstac-remote-pdb
Remote vanilla PDB (over TCP sockets)done right: no extras, proper handling around connection failures and CI. Based
onpdbx.Free software: BSD 2-Clause LicenseInstallationpip install remote-pdbUsageTo open a remote PDB on first available port:fromremote_pdbimportset_traceset_trace()# you'll see the port number in the logsTo use some specific host/port:fromremote_pdbimportRemotePdbRemotePdb('127.0.0.1',4444).set_trace()To connect just runtelnet 127.0.0.1 4444.  When you are finished
debugging, either exit the debugger, or press Control-], then Control-d.Alternately, one can connect with NetCat:nc-C127.0.0.1 4444or Socat:socat readline tcp:127.0.0.1:4444(for line editing and history support).  When finished debugging, either exit
the debugger, or press Control-c.Integration with breakpoint() in Python 3.7+If you are using Python 3.7 one can use the newbreakpoint()built in to invoke
remote PDB. In this case the following environment variable must be set:PYTHONBREAKPOINT=remote_pdb.set_traceThe debugger can then be invoked as follows, without any imports:breakpoint()As thebreakpoint()function does not take any arguments, environment variables can be used to
specify the host and port that the server should listen to. For example, to runscript.pyin such a
way as to maketelnet 127.0.0.1 4444the correct way of connecting, one would run:PYTHONBREAKPOINT=remote_pdb.set_traceREMOTE_PDB_HOST=127.0.0.1REMOTE_PDB_PORT=4444pythonscript.pyIfREMOTE_PDB_HOSTis omitted then a default value of 127.0.0.1 will be used. IfREMOTE_PDB_PORTis
omitted then the first available port will be used. The connection information will be logged to the console,
as with calls toremote_pdb.set_trace().Note about OS XIn certain scenarios (backgrounded processes) OS X will prevent readline to be imported (and readline is a dependency of pdb).
A workaround (run this early):importsignalsignal.signal(signal.SIGTTOU,signal.SIG_IGN)See#9andcpython#14892.RequirementsPython 2.6, 2.7, 3.2, 3.3 and PyPy are supported.Similar projectsqdbChangelog1.3.0 (2019-03-13)Documented support for Python 3.8’sbreakpoint().Added support for setting the socket listening host/port through theREMOTE_PDB_HOST/REMOTE_PDB_PORTenvironment variables. Contributed by Matthew Wilkes in#14.Removed use ofrwfile wrappers around sockets (turns out socket’smakefileis very buggy in Python 3.6 and
later -output is discarded). Contributed in#13.1.2.0 (2015-09-26)Always print/log listening address.1.1.3 (2015-07-06)Corrected the default frame tracing starts from.1.1.2 (2015-07-06)Small readme update.1.1.1 (2015-07-06)Remove bogusremote_pdbconsole script.1.1.0 (2015-06-21)Fixed buffering issues when running on Python 3 and Windows.1.0.0 (2015-06-15)Added support for PDB++.0.2.1 (2014-03-07)First release on PyPI.
Package: coinstac-sparse-dinunet
coinstac-sparse-dinunetDistributed Sparse Neural Network implementation  on COINSTAC.pip install coinstac-sparse-dinunetSpecify supported packages like pytorch & torchvision in a requirements.txt fileHighlights:1. Creates sparse network based on single shot pruning SNIP algorithm (https://arxiv.org/abs/1810.02340). 
2. Performs distributed training and optimization with reduced bandwidth.
3. Automatic data splitting/k-fold cross validation.
4. Automatic model checkpointing.
5. GPU enabled local sites.
6. Customizable metrics(w/Auto serialization between nodes) to work with any schemes.
7. We can integrate any custom reduction and learning mechanism by extending coinstac_sparse_dinunet.distrib.reducer/learner.
...Running an analysisin the coinstac App.Add a new NN computation to COINSTAC (Development guide):importsfromcoinstac_sparse_dinunetimportCOINNDataset,COINNTrainer,COINNLocalfromcoinstac_sparse_dinunet.metricsimportCOINNAverages,Prf1a1. Define Data LoaderclassMyDataset(COINNDataset):def__init__(self,**kw):super().__init__(**kw)self.labels=Nonedefload_index(self,id,file):data_dir=self.path(id,'data_dir')# data_dir comes from inputspecs.json...self.indices.append([id,file])def__getitem__(self,ix):id,file=self.indices[ix]data_dir=self.path(id,'data_dir')# data_dir comes from inputspecs.jsonlabel_dir=self.path(id,'label_dir')# label_dir comes from inputspecs.json...# Logic to load, transform single data item....return{'inputs':..,'labels':...}2. Define TrainerclassMyTrainer(COINNTrainer):def__init__(self,**kw):super().__init__(**kw)def_init_nn_model(self):self.nn['model']=MYModel(in_size=self.cache['input_size'],out_size=self.cache['num_class'])defsingle_iteration_for_masking(self,model,batch):#Defines sparsity level, loss function and other parameters to perform masking using SNIPsparsity_level=0.85inputs,labels=batch['inputs'].to(self.device['gpu']).float(),batch['labels'].to(self.device['gpu']).long()indices=batch['ix'].to(self.device['gpu']).long()model.zero_grad()out=F.log_softmax(model.forward(inputs),1)loss=F.nll_loss(out,labels)return{'out':out,'loss':loss,'indices':indices,'sparsity_level':sparsity_level}defiteration(self,batch):inputs,labels=batch['inputs'].to(self.device['gpu']).float(),batch['labels'].to(self.device['gpu']).long()out=F.log_softmax(self.nn['model'](inputs),1)loss=F.nll_loss(out,labels)_,predicted=torch.max(out,1)score=self.new_metrics()score.add(predicted,labels)val=self.new_averages()val.add(loss.item(),len(inputs))return{'out':out,'loss':loss,'averages':val,'metrics':score,'prediction':predicted}Advanced use cases:Define custom metrics:Extendcoinstac_sparse_dinunet.metrics.COINNMetricsExample:coinstac_sparse_dinunet.metrics.Prf1afor Precision, Recall, F1, and AccuracyDefineCustom Learner/ [custom Aggregator]/custom Aggregator(Default is Distributed SGD)Referenced from Trends Center coinstac-dinunet repository (https://github.com/trendscenter/coinstac-dinunet)
Package: coinswitchclient
A Simple python library for coinswitchThis is a simple library that uses coinswitch APIs.
It is just a collection of utils to manipulate, interpret and simplify calls to their APIsHow to useFirst install the package with pippip install coinswitchclientThen be sure to have your API key. If not it defaults to a sandbox api key
There are two major blocks inside this package:TransactionManager: it is a set of function that call the v2 instant APICoinSwitchV1Client: function that reflect the v1 coinswitch apiCoinSwitchV2FixedClient: function that reflect the v2 fixed coinswitch apiCoinSwitchV2InstantClient: function that reflect the v2 instant coinswitch apiApiResponse: an object that represent the reponse from coinswitch apisYou can find examples inside thetestdirectory of this repo.Usage of ApiResponseYou never have to crete this object, but it will be return by each api calls.
Here is the global structure of an ApiResponse{"success":true,"code":"","data":"","error":""}The ApiResponse object provide simple method to access basic informationapi_response.is_success()# returns a booleanapi_response.code()# return the code string in the "code" fieldapi_response.message()# returns the content of error or msg depending on the remote responseapi_response.data()# return a dict object that represent the dataPlease seehttps://developer.coinswitch.co/for any information of the returned fields in the data messageUsage for TransactionManager# import required modules and classesfromcoinswitch_client.TransactionManagerimportTransactionManagerfromcoinswitch_client.APIClientimportAddress# create an instance of the transaction managermanager=TransactionManager(api_key="MY_API_KEY")# Ask to convert 1 BTC to ETH withmanager.convert('btc','eth',1.0,Address('ETH_ADDRESS').json(),Address('REFUND_ADDRESS').json())#this function returns the response from the coinswitch api as a ApiResponseUsage for CoinSwitchV1ClientIt follows thehttps://developer.coinswitch.co/apis
Here is a simple usage thoughfromcoinswitch_client.APIClientimportCoinSwitchV1Clientclient=CoinSwitchV1Client(api_key="MYKEY")api_response=client.coins()ifapi_response.is_success():print(api_response.data())Usage for CoinSwitchV2InstantClientIt follows thehttps://developer.coinswitch.co/apis
Here is a simple usage thoughfromcoinswitch_client.APIClientimportCoinSwitchV2InstantClientclient=CoinSwitchV2InstantClient(api_key="MYKEY")api_response=client.coins()ifapi_response.is_success():print(api_response.data())api_response=client.rates('btc','eth')ifapi_response.is_success():print(api_response.data())Usage for CoinSwitchV2FixedClientIt follows thehttps://developer.coinswitch.co/apis
Here is a simple usage thoughfromcoinswitch_client.APIClientimportCoinSwitchV2FixedClientclient=CoinSwitchV2FixedClient(api_key="MYKEY")api_response=client.coins()ifapi_response.is_success():print(api_response.data())api_response=client.place_offer('btc','eth',quantity_from=1.0)ifapi_response.is_success():print(api_response.data())
Package: cointables
cointablesCointables is a Python package that provides a simple and convenient framework to extract historical Open-High-Low-Close (OHLC) data for various cryptocurrencies from Binance. Cointables supports different sampling methods and GET approaches, allowing users to customize their data extraction process. This is a fork frombitchartsInstallationCointables can be installed using pip:pip install cointablesIt is recommended you run voxelmap using avirtualenvvirtual environment. To do so, follow the below simple protocol to create the virtual environment, run it, and install the package there:virtualenv venv
source venv/bin/activate
pip install cointablesTo exit the virtual environment, simply type deactivate. To access it at any other time again, enter with the above sourcevenv...command.
Package: cointainer-scraper-ecb
Cointainer component for scraping coins from the ECB Website.IntroductionCointainer Scraper (ECB) is one of the components of the Cointainer. This component offers the functionality of scraping euro coin data from the ECB website.Currently supported coins:€2 commemorative coinsCountryFeatureDescriptionIssuing VolumeIssuing DateImage URLsInstallationpipinstallcointainer-scraper-ecbExamplefromcointainer_scraper_ecbimportget_two_euro_commemorative_coinsget_two_euro_commemorative_coins(language="en",year=2004)Tested with Python 3.9.13 and cointainer_scraper_ecb v0.1.3 ✔️Two data classes are relevant which are beeing returned by the function:defget_two_euro_commemorative_coins(lang:str="en",year:int=START_YEAR)->List[TwoEuro]:...@dataclassclassCoinage:"""Represents a coin of a country to be collected."""country:Optional[str]image_default_url:Optional[str]volume:Optional[int]image_default_url_info:Optional[str]=Nonecountry_info:Optional[str]=Nonecirculation_date:Optional[datetime.date]=Noneimage_attribution:Optional[str]=Nonecirculation_date_info:Optional[str]=Nonevolume_info:Optional[str]=None@dataclassclassTwoEuro:"""A two euro coin to collect."""feature:str=""description:str=""coinages:List[Coinage]=field(default_factory=list)RoadmapImplement national side scraping (2€, 1€, 50 cent, 20 cent, 10 cent, 5 cent, 2 cent and 1 cent)CLI implementation with clickDevelopmentCreating a new releaseRun the following commandpoetry version <version>cointainer-scraper-ecbuses the following schema:^\d+\.\d+\.\d+((b|a)\d+)?$Bump the version within the files:cointainer_scraper_ecb/__init__.pytests/test_cointainer_scraper_ecb.pypyproject.tomlMake sure it's the same version used when bumping with poetryOpenCHANGELOG.mdand write the new changelog:Use the following#header:v<version> - (yyyy-mm-dd)Used##headers:💌 Added🔨 Fixed♻️ ChangedStage the modified files and push them with the following commit message:chore: bump to versionv<version>Create annotated release tagNew taggit tag -s -m "release v<version>" v<version>Push created taggit push --tagsRun the following commandpoetry buildto create a tarball and a wheel based on the new versionCreate a new github release and:Copy and paste the changelog contentwithoutthe#header into thedescription of the releasetextboxUse the#header style to fill in theRelease title(copy it from theCHANGELOG.md)Copy the version with thev-prefix into theTag versionAttach the produced tarball and wheel (dist/) to the releaseCheckThis is a pre-releaseif it's either an alpha or beta release(a|b)-optionalPublish releaseTestingUse the following command to execute the tests:poetryrunpytestTo run the tests, the:download-test-files.(ps1|sh)script must be executed.This is not the best method because the test data can change. However, I don't know if it is allowed to upload the data to the repository because of the copyright.LicenseThis cointainer-scraper-ecb module is distributed under Apache-2.0. For ODbL-1.0 exception, seeLICENSING.md
Package: coin-test
coin-testCoin-test is a backtesting library designed for cryptocurrency trading. It supports trading strategies across multiple currencies and advanced configurations of tests, including cron-based scheduled execution of strategies, synthetic data generation, slippage modeling, and trading fees.Quick StartCoin-test runs on Python 3.10 or higher. Install the package via pip:pip3installcoin-testTo run a backtest, import the coin-test library. Then define your data source, strategy, and test settings to run the analysis.importdatetimeasdtimportosimportpandasaspdfromcoin_test.backtestimportPortfolio,Strategy,MarketTradeRequestfromcoin_test.dataimportCustomDatasetfromcoin_test.utilimportAssetPair,Ticker,Money,SideThen, import data from a CSV or another source to load
into the backtest.dataset_file="data/ETHUSDT-1h-monthly/BTCUSDT-1h-2017-08.csv"header=["Open Time","Open","High","Low","Close","Volume","Close Time","Quote asset volume","Number of trades","Taker buy base asset volume","Taker buy quote asset volume","Ignore"]df=pd.read_csv(dataset_file,names=header)df=df.drop(columns=["Close Time","Quote asset volume","Number of trades","Taker buy base asset volume","Taker buy quote asset volume","Ignore"])df["Open Time"]//=1000# To secondsdf=df.sort_values(by=["Open Time"])# define dataset metadatausdt=Ticker("USDT")btc=Ticker("BTC")asset_pair=AssetPair(btc,usdt)freq="H"dataset=CustomDataset(df,freq,asset_pair)Strategies are stored in classes as shown below. Each strategy
should have a schedule, which is a cron string representing
when this strategy is run, a lookback, which is how much
data is accessed in the strategy, and a__call__method
which returns a list of TradeRequest objects, which represent
trades the strategy wants to make.classMACD(Strategy):def__init__(self,asset_pair)->None:"""Initialize a MACD object."""super().__init__(name="MACD",asset_pairs=[asset_pair],schedule="0 9 * * *",lookback=dt.timedelta(days=26),)self.perc=0.2def__call__(self,time,portfolio,lookback_data):"""Execute test strategy."""asset_pair=self.asset_pairs[0]exp1=lookback_data[asset_pair]["Close"].ewm(span=12*24,adjust=False).mean()exp2=lookback_data[asset_pair]["Close"].ewm(span=26*24,adjust=False).mean()macd=exp1-exp2exp3=macd.ewm(span=9*24,adjust=False).mean()ifmacd.iloc[-1]>exp3.iloc[-1]:return[MarketTradeRequest(asset_pair,Side.BUY,notional=portfolio.available_assets(usdt).qty*self.perc,)]elifmacd.iloc[-1]<exp3.iloc[-1]:return[MarketTradeRequest(asset_pair,Side.SELL,qty=portfolio.available_assets(btc).qty*self.perc,)]return[]This package supports multiple strategies, train-test splits
for historical data, synthetic data, and further customization.
To run the backtest, define the datasetsfromcoin_test.backtestimportConstantSlippage,ConstantTransactionFeeCalculatorsc=ConstantSlippage(50)tc=ConstantTransactionFeeCalculator(50)datasets=[dataset]strategies=[MACD]results=coin_test.run(datasets,strategies,sc,tc,portfolio,pd.Timedelta(days=90),n_parallel=8)
Package: cointools
Cointoolspypi :https://pypi.org/project/cointools/Install-> pip install cointoolsimportfrom cointools.manager import MultipleManager
from cointools.service import BaseServiceHandlerexample1) class MultipleManagerclass MyManager(MultipleManager) : 
    def connect(self) : 
        pass 

    def setter(self) : 
        pass

    def finish(self, ticker) :
        pass

    def verify_to_service(self) :
        pass

    def verify_to_ticker(self) : 
        passconnect(self) -> Noneyou 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])setter(self) -> strThis function is a custom input function to obtain the desired ticker." you can make the black list about using ticker. "example(setter)...
    def setter(self) : 
        return input("Which ticker do you want ?: ")finish(self, ticker) -> NoneThis is a function that works after end the thread." you can remove ticker in black list. "example(finish)...
    def finish(self, ticker) : 
        passverify_to_service(self) -> boolit is used for functions that require confirmation before service start.example(verify_to_service)...
    def verify_to_service(self) : 
        return Trueverify_to_ticker(self) -> boolit is used to check the ticker after receiving the ticker.example(verify_to_ticker)...
    def verify_to_service(self) : 
        return True2) class BaseServiceHandler...
class MyService(BaseServiceHandler) : 
    def setup(self) : 
        pass 

    def action(self) : 
        pass

    def finish(self) : 
        passvalue_conn : it's connection of bitcoin exchange API._ticker : it's ticker in the thread.setup(self) -> NoneThis is a function that sets up before the action is executed....
    def setup(self) : 
        self._price = Noneaction(self) -> NoneThis 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()
Package: coinzdense
Library for hash-based signatures.The CoinZdense projects aim to provide simple post-quantum-ready
hash-based signatures geared specifically at :utility blockchain projectsdistributed exchange projectsother blockchain projects that are commonly used in a key-reuse
by design way.CoinZdense explicitly does NOT aim at being a post-quantum solution
for blockchain projects that neither rely nor would benefit from
extensive re-usage of signing keys.Seehttps://coin.z-den.se/for more info.