{"id":20103116,"url":"https://github.com/strader07/trading-system","last_synced_at":"2025-05-06T08:31:06.013Z","repository":{"id":259588484,"uuid":"362698187","full_name":"strader07/trading-system","owner":"strader07","description":"trading system best practises","archived":false,"fork":false,"pushed_at":"2021-04-29T16:23:25.000Z","size":6712,"stargazers_count":7,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T12:51:15.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/strader07.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}},"created_at":"2021-04-29T05:16:44.000Z","updated_at":"2023-12-06T14:27:07.000Z","dependencies_parsed_at":"2024-10-27T00:11:47.724Z","dependency_job_id":null,"html_url":"https://github.com/strader07/trading-system","commit_stats":null,"previous_names":["strader07/trading-system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Ftrading-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Ftrading-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Ftrading-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strader07%2Ftrading-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strader07","download_url":"https://codeload.github.com/strader07/trading-system/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252648503,"owners_count":21782397,"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":[],"created_at":"2024-11-13T17:34:20.274Z","updated_at":"2025-05-06T08:31:04.446Z","avatar_url":"https://github.com/strader07.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## How to connect local python app to redis on dev\n1. brew cask install google-cloud-sdk (apt install google-cloud-sdk)\n2. brew install kubernetes-cli (apt install kubernetes-cli)\n3. gcloud container clusters get-credentials muzna-bo-aio-01 --zone europe-west2-c --project strange-metrics-258802\n4. kubectl config rename-context gke_strange-metrics-258802_europe-west2-c_muzna-bo-aio-01 muzna-aio\n5. kubectl --context muzna-aio --namespace development port-forward svc/redis 6379:6379\n6. make run service \u003cservice-name\u003e (i.e: `make run service python-service`)\n\n### Some prerequisites are needed for number 6  to work\n1. The Microservice must be located under services  directory\n2. main.py is the located at the root of the microservice directory and has the main function\n3. requirements.txt is the located at the root of the microservice directory\n4. Dockerfile is the located at the root of the microservice directory\n5. k8s is the located at the root of the microservice directory\n\n## To connect to redis dev on localhost:6379:\n```\nkubectl --context muzna-aio --namespace development port-forward svc/redis 6379:6379\nkubectl --context muzna-aio --namespace development port-forward svc/redis-exposed 6380:6379\n```\n\n## URLs:\n- http://dashboard.dev.muwazana.com/\n- http://dashboard.dev.muwazana.com/ws\n\n## Redis\nLocal: redis:6789 and redis-exposed:6789\nExternal: redis-exposed.ftx.dev.muwazana.com\n\n## Secrets\n1.Generate secrets - this is base64 encoded but not encrypted\n```bash\nkubectl --context muzna-aio --namespace development create secret generic ftx-dropcopy --from-literal=FTXKEY=CYZ -o yaml --dry-run \u003e k8s/base/k8s-sec.yaml\n```\n\n2 Apply\n```bash\nkubectl --context muzna-aio --namespace development apply -f services/ftx-dropcopy/k8s/base/k8s-cm.yaml\nkubectl --context muzna-aio --namespace development apply -f k8s/base/k8s-sec.yaml\n```\n\n## Sealed secrets\n```bash\nkubectl -n development create secret generic ftx-dropcopy --dry-run --from-literal=foo=bar -o yaml | kubeseal --context muzna-aio --controller-namespace commons --controller-name sealed-secrets -o yaml \u003e services/ftx-dropcopy/k8s/base/k8s-ssec.yaml\n```\n\nMake sure k8s-ssec.yaml is in kustomization.yml.\n\n## Deploy\n```\nmake manual-deploy service ftx-dropcopy development/development\nmake manual-deploy service ftx-dashboard development/development\nmake manual-deploy service redis-exposed development/development\nmake manual-deploy job mktdata-archiver development/development\n```\n\nUI:\n```\nmake manual-deploy app ftx-dashboard development/development\n```\n\nTo generate/view a manifest file (never needed, auto done in manual deploy)\n```bash\nmake gen service ftx-dropcopy development/development\n```\n\n## Control scaling\n```bash\nkubectl --context muzna-aio --namespace development scale --replicas 0 deployment ftx-dropcopy\n```\n\n## k9s\nCtrl-A abbreviations\ndp deployment (delete here to remove pods)\ns shell\nl stdout/stderr\np go up\ny/enter view secrets\n:ctx context\n:ns development\n:sec secrets\n\n## Rebuild base docker image\n```bash\nmake build docker python\n```\n\nReplace python with service or [all] as well.\n\n## Jobs\nBuild app\n```bash\nmake build image mktdata-archiver\n```\n\nTo update the app, manually update the `argo-workflow.yaml` file and apply it in k8s.\n\nRun mktdata-archiver cronjob as a job:\n```bash\nkubectl create job --from=cronjob/mktdata-archiver \u003cjob-name\u003e\n```\n\n## Tardis Machine\nPort forwarding:\n```bash\nkubectl --context muzna-aio --namespace development port-forward svc/tardis-machine 8000:8000\n```\n\nInternal URL: http://tardis-machine:8000\n\n\n## JupyterLab\nSee `helm/jupyterlab` and `infrastructure/docker/jupyterlab`\n\n### Update image\n1. Update `infrastructure/docker/jupyterlab/Dockerfile`\n2. Build image: `docker build -f Dockerfile .`\n3. Run: `infrastructure/docker/jupyterlab/update_registry.sh \u003csource image\u003e \u003cversion\u003e`\n4. Update version in `helm/jupyterlab/config.yaml`\n5. Run `helm/jupyterlab/upgrade.sh`\n\n## Helm Client Setup\n1. Download helmv2 from https://github.com/helm/helm/releases and copy it as `helm2` into your $PATH.\n2. `helm2 init`\n3. `helm2 repo update`\n4. `helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/`\n5. `helm2 repo update`\n\n### Install gcloud CLI in Jupyterhub\n```bash\ncurl -sSL https://sdk.cloud.google.com \u003e /tmp/gcl \u0026\u0026 bash /tmp/gcl --install-dir=~/gcloud --disable-prompts\n./gcloud/google-application-sdk/gcloud auth application-default login\n```\n\n## Poetry MWZ Pypi Repo Setup\n```bash\npoetry config repositories.mwz https://nexus.tools.muwazana.com/repository/muwazana-hosted-pypi/\npoetry config http-basic.mwz muwazana-user \u003cPASSWORD\u003e\n```\n\nFor apps that need to use the repo, set the repo to pyproject.toml repo url:\n```toml\n[[tool.poetry.source]]\nname = \"mwz\"\nurl = \"https://nexus.tools.muwazana.com/repository/muwazana-pypi/simple\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrader07%2Ftrading-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrader07%2Ftrading-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrader07%2Ftrading-system/lists"}