{"id":19208608,"url":"https://github.com/heiwa4126/sam-stock-trader","last_synced_at":"2026-06-24T09:32:06.675Z","repository":{"id":111911475,"uuid":"476207471","full_name":"heiwa4126/sam-stock-trader","owner":"heiwa4126","description":"同名のAWS SAMのStep Functionsのサンプルテンプレートに、コメントなどをつけていく。学習用。","archived":false,"fork":false,"pushed_at":"2022-04-01T04:30:24.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T07:16:30.968Z","etag":null,"topics":["aws-sam","example","stepfunction"],"latest_commit_sha":null,"homepage":"","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/heiwa4126.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":"2022-03-31T07:57:51.000Z","updated_at":"2022-04-01T01:16:03.000Z","dependencies_parsed_at":"2023-05-18T12:32:13.898Z","dependency_job_id":null,"html_url":"https://github.com/heiwa4126/sam-stock-trader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/heiwa4126/sam-stock-trader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-stock-trader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-stock-trader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-stock-trader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-stock-trader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heiwa4126","download_url":"https://codeload.github.com/heiwa4126/sam-stock-trader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-stock-trader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34724746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["aws-sam","example","stepfunction"],"created_at":"2024-11-09T13:27:10.896Z","updated_at":"2026-06-24T09:32:06.655Z","avatar_url":"https://github.com/heiwa4126.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sam-stock-trader\n\n[aws-sam-cli-app-templates/python3.9/cookiecutter-aws-sam-step-functions-sample-app/{{cookiecutter.project_name}} at master · aws/aws-sam-cli-app-templates](https://github.com/aws/aws-sam-cli-app-templates/tree/master/python3.9/cookiecutter-aws-sam-step-functions-sample-app/%7B%7Bcookiecutter.project_name%7D%7D)\nにあるAWS SAMのサンプルテンプレートに手をいれたもの。\nコードを読みながら、コメントとか入れていく。\n\nほか参照:\n- [AWS SAM を使用して Step Functions ステートマシンを作成 - AWS Step Functions](https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/tutorial-state-machine-using-sam.html)\n\nSAMだとASLはYAMLで書ける。便利。\n\n# 動作メモ\n\n起動は\nAWS::Events::Rule\nで1時間に1回(デプロイ時はdisable)\n\nASLで最初は\nStockCheckerFunction\nfunctions/stock_checker/app.py\n\nもし stock_price が50以下なら\nBuy Stock へ。\nそれ以外は Sell Stock へ。\n\nBuy Stock は\nfunctions/stock_buyer/app.py\n\nSell Stock は\nfunctions/stock_seller/app.py\n\nで、\nRecord Transaction で\nDynamoDBに入れる。\nすごいのはここASLでできること。\n\n\n# ステートマシンのデプロイ\n\nSAMなので\n\n```sh\nsam build\nsam deploy --guided # --guidedは2回め以降は不要\n```\n\n# ステートマシンの実行\n\nコマンドラインから実行するサンプル `start_statemachine.sh`。\n\nデプロイ成功後、準備として\n```sh\npip3 install -U -r requirements.txt\n./export1.py\n```\nを1回実行。\n\nその後\n```sh\n./start_statemachine.sh\n```\nでステートマシンが実行される。\n\n\n\n# 最適化統合(optimized integrations)\n\n`arn:aws:states:::dynamodb:putItem`\nみたいののリファレンスはどこにある?\n\nここ:\n- [Step Functions 用統合最適化 - AWS Step Functions](https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/connect-supported-services.html) タイトルから想像できない内容...\n- DynamoDBについては [Step Functions を使用した DynamoDB API の呼び出し](https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/connect-ddb.html)\n\n統合最適化(optimized integrations)以外の呼び出し方は\n[他のサービスで AWS Step Functions を使用する - AWS Step Functions](https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/concepts-service-integrations.html)\n\n`arn:aws:states:::aws-sdk:*` を使う\n[AWS SDK のサービスの統合 - AWS Step Functions](https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/supported-services-awssdk.html)\nなど。「SDK統合」。いちいちlambdaを書かなくてもいいケースが増える。\n\n\n\n# ASLの '$.' とは?\n\nJsonPath。ASL内では使えない関数あり(lenght()とか)\n\n\u003e パスは、JSON テキスト内でコンポーネントを識別するために使用できる $ で始まる文字列です\n\n- [パス - AWS Step Functions](https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/amazon-states-language-paths.html)\n- [json-path/JsonPath: Java JsonPath implementation](https://github.com/json-path/JsonPath)\n- [JSONPath Online Evaluator](https://jsonpath.com/)\n\n\n# ASLの '.$' とは?\n\n[InputPath、パラメータ、および ResultSelector - AWS Step Functions](https://docs.aws.amazon.com/ja_jp/ja_jp/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters)\n\n\u003e パスを使用して値を選択するキーと値のペアの場合、キーの名前は .$ で終わる必要があります。\n\n\n# ASLの仕様は\n\nここ: [Amazon States Language](https://states-language.net/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fsam-stock-trader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheiwa4126%2Fsam-stock-trader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fsam-stock-trader/lists"}