yoshikouki / dividend-portal

1 stars 1 forks source link

Dividend::Recent.refresh_us で企業が重複作成される問題 #57

Closed yoshikouki closed 3 years ago

yoshikouki commented 3 years ago
  Company Bulk Insert (1.5ms)  INSERT INTO "companies" ("symbol","name","currency","exchange","exchange_short_name","industry","sector","country","image","ipo_date","created_at","updated_at") VALUES ('BHB', 'Bar Harbor Bankshares', 'USD', 'NYSE American', 'AMEX', 'Banks—Regional', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/BHB.png', '1995-05-12', '2021-08-13 12:36:56.543187', '2021-08-13 12:36:56.543351'), ('COHN', 'Cohen & Company Inc.', 'USD', 'NYSE American', 'AMEX', 'Capital Markets', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/COHN.png', '2004-03-18', '2021-08-13 12:36:56.543817', '2021-08-13 12:36:56.543869'), ('DMF', 'BNY Mellon Municipal Income, Inc.', 'USD', 'NYSE American', 'AMEX', 'Asset Management', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/DMF.png', '1988-10-21', '2021-08-13 12:36:56.544132', '2021-08-13 12:36:56.544144'), ('EVY', 'Eaton Vance New York Municipal Income Trust', 'USD', 'NYSE American', 'AMEX', 'Asset Management', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/EVY.png', '1999-01-28', '2021-08-13 12:36:56.544627', '2021-08-13 12:36:56.544634'), ('PRK', 'Park National Corporation', 'USD', 'NYSE American', 'AMEX', 'Banks—Regional', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/PRK.png', '1990-08-31', '2021-08-13 12:36:56.547648', '2021-08-13 12:36:56.547664'), ('SEB', 'Seaboard Corporation', 'USD', 'NYSE American', 'AMEX', 'Conglomerates', 'Industrials', 'US', 'https://financialmodelingprep.com/image-stock/SEB.png', '1981-05-22', '2021-08-13 12:36:56.548417', '2021-08-13 12:36:56.548430') ON CONFLICT  DO NOTHING RETURNING "id"
Company Bulk Insert (1.5ms)
INSERT INTO "companies" 
    ("symbol","name","currency","exchange","exchange_short_name","industry","sector","country","image","ipo_date","created_at","updated_at") 
VALUES 
    ('BHB', 'Bar Harbor Bankshares', 'USD', 'NYSE American', 'AMEX', 'Banks—Regional', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/BHB.png', '1995-05-12', '2021-08-13 12:36:56.543187', '2021-08-13 12:36:56.543351'), 
    ('COHN', 'Cohen & Company Inc.', 'USD', 'NYSE American', 'AMEX', 'Capital Markets', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/COHN.png', '2004-03-18', '2021-08-13 12:36:56.543817', '2021-08-13 12:36:56.543869'), 
    ('DMF', 'BNY Mellon Municipal Income, Inc.', 'USD', 'NYSE American', 'AMEX', 'Asset Management', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/DMF.png', '1988-10-21', '2021-08-13 12:36:56.544132', '2021-08-13 12:36:56.544144'), 
    ('EVY', 'Eaton Vance New York Municipal Income Trust', 'USD', 'NYSE American', 'AMEX', 'Asset Management', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/EVY.png', '1999-01-28', '2021-08-13 12:36:56.544627', '2021-08-13 12:36:56.544634'), 
    ('PRK', 'Park National Corporation', 'USD', 'NYSE American', 'AMEX', 'Banks—Regional', 'Financial Services', 'US', 'https://financialmodelingprep.com/image-stock/PRK.png', '1990-08-31', '2021-08-13 12:36:56.547648', '2021-08-13 12:36:56.547664'), 
    ('SEB', 'Seaboard Corporation', 'USD', 'NYSE American', 'AMEX', 'Conglomerates', 'Industrials', 'US', 'https://financialmodelingprep.com/image-stock/SEB.png', '1981-05-22', '2021-08-13 12:36:56.548417', '2021-08-13 12:36:56.548430') 
ON CONFLICT  DO NOTHING RETURNING "id"
yoshikouki commented 3 years ago
irb(Company):004:0> Company.where(symbol: 'PRK')
  Company Load (0.5ms)  SELECT "companies".* FROM "companies" WHERE "companies"."symbol" = $1  [["symbol", "PRK"]]
=>
[#<Company:0x000055679d06c868
  id: 563,
  symbol: "PRK",
  name: "Park National Corporation",
  exchange: "NYSE American",
  created_at: Fri, 13 Aug 2021 12:33:15.398379000 JST +09:00,
  updated_at: Fri, 13 Aug 2021 12:33:15.398389000 JST +09:00,
  industry: "Banks—Regional",
  sector: "Financial Services",
  country: "US",
  currency: "USD",
  exchange_short_name: "AMEX",
  ipo_date: Fri, 31 Aug 1990,
  image: "https://financialmodelingprep.com/image-stock/PRK.png",
  years_of_dividend_growth: nil>,
 #<Company:0x000055679d4c4d70
  id: 723,
  symbol: "PRK",
  name: "Park National Corporation",
  exchange: "NYSE American",
  created_at: Fri, 13 Aug 2021 12:33:36.694079000 JST +09:00,
  updated_at: Fri, 13 Aug 2021 12:33:36.694093000 JST +09:00,
  industry: "Banks—Regional",
  sector: "Financial Services",
  country: "US",
  currency: "USD",
  exchange_short_name: "AMEX",
  ipo_date: Fri, 31 Aug 1990,
  image: "https://financialmodelingprep.com/image-stock/PRK.png",
  years_of_dividend_growth: nil>,
 #<Company:0x000055679d4c4bb8
  id: 729,
  symbol: "PRK",
  name: "Park National Corporation",
  exchange: "NYSE American",
  created_at: Fri, 13 Aug 2021 12:34:17.687445000 JST +09:00,
  updated_at: Fri, 13 Aug 2021 12:34:17.687461000 JST +09:00,
  industry: "Banks—Regional",
  sector: "Financial Services",
  country: "US",
  currency: "USD",
  exchange_short_name: "AMEX",
  ipo_date: Fri, 31 Aug 1990,
  image: "https://financialmodelingprep.com/image-stock/PRK.png",
  years_of_dividend_growth: nil>,
 #<Company:0x000055679d4c4870
  id: 735,
  symbol: "PRK",
  name: "Park National Corporation",
  exchange: "NYSE American",
  created_at: Fri, 13 Aug 2021 12:36:30.849602000 JST +09:00,
  updated_at: Fri, 13 Aug 2021 12:36:30.849668000 JST +09:00,
  industry: "Banks—Regional",
  sector: "Financial Services",
  country: "US",
  currency: "USD",
  exchange_short_name: "AMEX",
  ipo_date: Fri, 31 Aug 1990,
  image: "https://financialmodelingprep.com/image-stock/PRK.png",
  years_of_dividend_growth: nil>,
 #<Company:0x000055679d4c45f0
  id: 741,
  symbol: "PRK",
  name: "Park National Corporation",
  exchange: "NYSE American",
  created_at: Fri, 13 Aug 2021 12:36:56.547648000 JST +09:00,
  updated_at: Fri, 13 Aug 2021 12:36:56.547664000 JST +09:00,
  industry: "Banks—Regional",
  sector: "Financial Services",
  country: "US",
  currency: "USD",
  exchange_short_name: "AMEX",
  ipo_date: Fri, 31 Aug 1990,
  image: "https://financialmodelingprep.com/image-stock/PRK.png",
  years_of_dividend_growth: nil>]
yoshikouki commented 3 years ago

exchange_short_name: "AMEX"に対応していなくてバグが起こっている様子 exchange: "NYSE American", exchange_short_name: "AMEX",

https://ja.wikipedia.org/wiki/NYSE_American