{"id":19014403,"url":"https://github.com/parrondo/deeptrading-tfserving-python","last_synced_at":"2025-04-23T00:43:12.627Z","repository":{"id":37066185,"uuid":"214810760","full_name":"parrondo/deeptrading-tfserving-python","owner":"parrondo","description":"Tensorflow serving client implementation for trading.","archived":false,"fork":false,"pushed_at":"2023-07-05T20:43:12.000Z","size":72028,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T00:43:06.342Z","etag":null,"topics":["forex-prediction","forex-trading","machine-learning","machinelearning-python","trading","trading-algorithms","trading-systems"],"latest_commit_sha":null,"homepage":"https://todotrader.com/deep-trading-with-tensorflow-viii/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parrondo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-10-13T11:48:53.000Z","updated_at":"2023-01-28T18:35:36.000Z","dependencies_parsed_at":"2025-04-17T05:37:45.447Z","dependency_job_id":"d1a859eb-82af-4241-b522-6dc9fa0cbf6a","html_url":"https://github.com/parrondo/deeptrading-tfserving-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrondo%2Fdeeptrading-tfserving-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrondo%2Fdeeptrading-tfserving-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrondo%2Fdeeptrading-tfserving-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parrondo%2Fdeeptrading-tfserving-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parrondo","download_url":"https://codeload.github.com/parrondo/deeptrading-tfserving-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250348889,"owners_count":21415907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forex-prediction","forex-trading","machine-learning","machinelearning-python","trading","trading-algorithms","trading-systems"],"created_at":"2024-11-08T19:29:15.989Z","updated_at":"2025-04-23T00:43:12.600Z","avatar_url":"https://github.com/parrondo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deeptrading-tfserving-python\n\n\u003c!---\nClient from https://github.com/epigramai/tfserving-python-predict-client\n--\u003e\n\n## Tensorflow serving client\nThis is a tensorflow serving client implementation from https://github.com/epigramai/tfserving-python-predict-client.\n\nYou can find here a Tensorflow client examples to trade.\n\nThe predict client is meant to be used with a model served by TensorFlow Serving. Because tfserving model server runs a gRPC service, it cannot be requested by just sending a normal HTTP request. The predict_client package is a grcp client that can request the service.\n\nRead the author's blog posts about TensorFlow Serving:\n\n[Part 1](https://medium.com/p/a79726f7c103/) and [Part 2](https://medium.com/p/682eaf7469e7/)\n\nand also my post serie: Deeptrading with tensorflow specially:\nhttps://todotrader.com/deep-trading-with-tensorflow-viii/\n\n\n### Install\n`conda create --name myenv`\n\n`$ conda activate myenv`\n\n`(myenv)$ pip install git+https://github.com/parrondo/deeptrading-tfserving-python.git`\n\n\n### If you need a model server\nThere is one here https://github.com/bitnami/bitnami-docker-tensorflow-serving\n\n## How to use\nCheck out the examples.\n\nExample 1 use fixed enter data and request a response from the serving model.\n\nExample 2 generates random data simulating some Forex enter data and request a response from the serving model.\n\n### predict_client.prod_client ProdClient\ndef __init__(self, host, model_name, model_version):\n - host: the host (e.g. '0.0.0.0:8500')\n - model_name: your model name, e.g. '07_First_Forex_Prediction'\n - model_version: model version, e.g. 1.\n \nProdClient.predict(self, request_data, request_timeout=10):\n - request_data: A list of input tensors, see the example.\n - request_timeout: timeout sent to the grcp stub\n \n `from predict_client.prod_client import ProdClient`\n \n `client = ProdClient('localhost:9000', 'mnist', 1)`\n \n `client.predict(request_data)`\n \n The predict function returns a dictionary with keys and values for each output tensor. The values in the dictionary will have the same shapes as\n the output tensor's shape. If an error occurs, predict will return an empty dict.\n \n### predict_client.inmemory_client InMemoryClient\ndef __init__(self, model_path):\n - model_path\n \nInMemoryClient.predict(self, request_data, request_timeout=None):\n - request_data and request_timeout same as ProdClient, except request_timeout not used in this client.\n \n `from predict_client.inmemory_client import InMemoryClient`\n \n `client = InMemoryClient('path/to/model.pb')`\n \n `client.predict(request_data)`\n \nThe predict function returns a dictionary with keys and values for each output tensor. The values in the dictionary will have the same shapes as\nthe output tensor's shape. If an error occurs, predict will return an empty dict.\n  \n### predict_client.mock_client MockClient\ndef __init__(self, mock_response):\n - mock_response\n \nMockClient.predict(self, request_data, request_timeout=None):\n - request_data and request_timeout same as ProdClient, except request_timeout not used in mock client.\n \n `from predict_client.mock_client import MockClient` \n \n `client = MockClient(mock_response)`\n \n `client.predict(request_data)`\n \nThe mock client predict function simply returns the mock response.\n\n\n## Development\n\n### Generate python code from .proto files\n\nCaution, this is not always trivial!\n\n`pip install grpcio-tools`\n`python -m grpc_tools.protoc -I protos/ --python_out=predict_client/pbs --grpc_python_out=predict_client/pbs protos/*`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparrondo%2Fdeeptrading-tfserving-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparrondo%2Fdeeptrading-tfserving-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparrondo%2Fdeeptrading-tfserving-python/lists"}