{"id":26121871,"url":"https://github.com/nirnejak/stocks-server","last_synced_at":"2025-07-10T17:33:29.232Z","repository":{"id":104356344,"uuid":"519541548","full_name":"nirnejak/stocks-server","owner":"nirnejak","description":"Golang Stocks Server","archived":false,"fork":false,"pushed_at":"2024-05-25T14:28:06.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-05T18:34:22.210Z","etag":null,"topics":["gin","gin-gonic","go","go-gin","go-server","golang","mysql","sql","stocks","stocks-api"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nirnejak.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-07-30T14:42:39.000Z","updated_at":"2024-05-25T14:32:37.000Z","dependencies_parsed_at":"2024-06-21T15:30:42.168Z","dependency_job_id":"755847a6-b27c-45eb-b2bf-11dcbbe10754","html_url":"https://github.com/nirnejak/stocks-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nirnejak/stocks-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirnejak%2Fstocks-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirnejak%2Fstocks-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirnejak%2Fstocks-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirnejak%2Fstocks-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirnejak","download_url":"https://codeload.github.com/nirnejak/stocks-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirnejak%2Fstocks-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264619655,"owners_count":23638491,"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":["gin","gin-gonic","go","go-gin","go-server","golang","mysql","sql","stocks","stocks-api"],"created_at":"2025-03-10T14:37:08.063Z","updated_at":"2025-07-10T17:33:29.216Z","avatar_url":"https://github.com/nirnejak.png","language":"Go","readme":"# Go Stocks Server\n\n**Run Server**\n\n```bash\ngo run .\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Setup and Seed Database\n\n**Create a database with the script below**\n\n```sql\nCREATE TABLE snp_500_financials (\n  symbol              VARCHAR(255),\n  name                VARCHAR(255),\n  sector              VARCHAR(255),\n  price               DOUBLE,\n  price_per_earnings  DOUBLE,\n  dividend_yield      DOUBLE,\n  earnings_per_share  DOUBLE,\n  fifty_two_week_low  DOUBLE,\n  fifty_two_week_high DOUBLE,\n  market_cap          DOUBLE,\n  EBITDA              DOUBLE,\n  price_per_sales     DOUBLE,\n  price_per_book      DOUBLE,\n  sec_filings         VARCHAR(255)\n);\n\n```\n\n**Seed Database(with sample data)** _Alternatively you can use `db.sql` file_\n\n```sql\nINSERT INTO snp_500_financials (\n  symbol,\n  name,\n  sector,\n  price,\n  price_per_earnings,\n  dividend_yield,\n  earnings_per_share,\n  fifty_two_week_low,\n  fifty_two_week_high,\n  market_cap,\n  EBITDA,\n  price_per_sales,\n  price_per_book,\n  sec_filings\n) VALUES\n('AAPL', 'Apple Inc.', 'Technology', 145.09, 28.45, 0.007, 5.11, 107.32, 157.26, 2.41e12, 84.69e9, 7.23, 33.45, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000320193'),\n('MSFT', 'Microsoft Corp.', 'Technology', 258.74, 35.12, 0.009, 7.74, 198.14, 282.30, 1.93e12, 75.25e9, 10.12, 14.34, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000789019'),\n('GOOGL', 'Alphabet Inc.', 'Communication Services', 2378.00, 30.22, 0.0, 93.81, 2100.00, 2441.00, 1.59e12, 91.71e9, 8.95, 5.98, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001652044'),\n('AMZN', 'Amazon.com Inc.', 'Consumer Discretionary', 3342.88, 61.20, 0.0, 52.56, 2881.00, 3552.25, 1.70e12, 48.15e9, 4.21, 17.68, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001018724'),\n('FB', 'Facebook Inc.', 'Communication Services', 327.66, 25.43, 0.0, 10.87, 244.61, 378.51, 0.93e12, 32.67e9, 10.34, 6.48, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001326801'),\n('TSLA', 'Tesla Inc.', 'Consumer Discretionary', 680.76, 1125.40, 0.0, 0.64, 273.00, 900.40, 0.65e12, 7.22e9, 21.07, 37.22, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001318605'),\n('BRK.B', 'Berkshire Hathaway Inc.', 'Financials', 278.26, 25.32, 0.003, 11.00, 202.13, 293.43, 0.63e12, 40.82e9, 2.59, 1.37, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001067983'),\n('JNJ', 'Johnson \u0026 Johnson', 'Health Care', 164.30, 28.42, 0.025, 6.12, 133.65, 173.65, 0.43e12, 25.10e9, 5.13, 6.04, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000200406'),\n('V', 'Visa Inc.', 'Information Technology', 235.30, 43.30, 0.006, 5.43, 179.23, 250.93, 0.51e12, 18.90e9, 22.90, 11.23, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001403161'),\n('WMT', 'Walmart Inc.', 'Consumer Staples', 140.32, 29.87, 0.015, 4.70, 117.01, 153.66, 0.40e12, 25.57e9, 0.76, 4.42, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000104169'),\n('JPM', 'JPMorgan Chase \u0026 Co.', 'Financials', 151.23, 12.58, 0.027, 12.02, 91.38, 159.03, 0.48e12, 55.21e9, 3.94, 1.76, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000019617'),\n('MA', 'Mastercard Inc.', 'Information Technology', 372.15, 52.44, 0.004, 7.10, 280.20, 398.25, 0.37e12, 17.68e9, 19.88, 51.07, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001141391'),\n('PG', 'Procter \u0026 Gamble Co.', 'Consumer Staples', 137.61, 25.73, 0.023, 5.35, 121.54, 146.92, 0.33e12, 18.52e9, 4.34, 7.15, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000080424'),\n('NVDA', 'NVIDIA Corporation', 'Information Technology', 589.38, 91.23, 0.001, 6.46, 323.00, 648.57, 0.36e12, 8.27e9, 22.42, 21.87, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001045810'),\n('DIS', 'Walt Disney Co.', 'Communication Services', 179.12, 46.29, 0.0, 3.87, 115.14, 203.02, 0.32e12, 13.10e9, 4.85, 3.54, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001744489'),\n('HD', 'Home Depot Inc.', 'Consumer Discretionary', 318.73, 24.67, 0.021, 13.14, 246.59, 345.69, 0.34e12, 18.92e9, 2.44, 178.39, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000354950'),\n('VZ', 'Verizon Communications Inc.', 'Communication Services', 58.24, 13.24, 0.046, 4.40, 49.69, 61.95, 0.24e12, 48.07e9, 1.88, 4.58, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000732717'),\n('PYPL', 'PayPal Holdings Inc.', 'Information Technology', 261.57, 80.45, 0.0, 3.25, 160.00, 309.14, 0.31e12, 4.18e9, 19.50, 15.72, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001633917'),\n('ADBE', 'Adobe Inc.', 'Information Technology', 512.45, 48.72, 0.0, 10.51, 420.78, 536.88, 0.24e12, 7.45e9, 20.50, 13.57, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0000796343'),\n('NFLX', 'Netflix Inc.', 'Communication Services', 503.55, 83.74, 0.0, 6.01, 384.00, 593.29, 0.23e12, 9.36e9, 8.74, 20.01, 'https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001065280');\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## cURL Commands\n\n**Get all Stocks**\n\n```bash\ncurl http://localhost:8080/stocks\n```\n\n**Get a Stock**\n\n```bash\ncurl http://localhost:8080/stocks/NFLX\n```\n\n**Create Stock**\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\n  \"symbol\": \"NFLX\",\n  \"name\": \"Netflix Inc.\",\n  \"sector\": \"Communication Services\",\n  \"price\": 503.55,\n  \"price_per_earnings\": 83.74,\n  \"dividend_yield\": 0.0,\n  \"earnings_per_share\": 6.01,\n  \"fifty_two_week_low\": 384.00,\n  \"fifty_two_week_high\": 593.29,\n  \"market_cap\": 0.23e12,\n  \"EBITDA\": 9.36e9,\n  \"price_per_sales\": 8.74,\n  \"price_per_book\": 20.01,\n  \"sec_filings\": \"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001065280\"\n}' http://localhost:8080/stocks\n\n```\n\n**Update Stock**\n\n```bash\ncurl -X PUT -H \"Content-Type: application/json\" -d '{\n  \"name\": \"Netflix Inc\",\n  \"sector\": \"Communication Services\",\n  \"price\": 503.55,\n  \"price_per_earnings\": 83.74,\n  \"dividend_yield\": 0,\n  \"earnings_per_share\": 6.01,\n  \"fifty_two_week_low\": 384,\n  \"fifty_two_week_high\": 593.29,\n  \"market_cap\": 230000000000,\n  \"EBITDA\": 9360000000,\n  \"price_per_sales\": 8.74,\n  \"price_per_book\": 20.01,\n  \"sec_filings\": \"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany\u0026CIK=0001065280\"\n}' http://localhost:8080/stocks/NFLX\n```\n\n**Delete Stock**\n\n```bash\ncurl -X DELETE http://localhost:8080/stocks/NFLX\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirnejak%2Fstocks-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirnejak%2Fstocks-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirnejak%2Fstocks-server/lists"}