Feat: Adds multi currency support (#88)
This commit is contained in:
@@ -41,22 +41,21 @@ class MarketDataSeeder extends Seeder
|
||||
|
||||
$data = array_combine($header, $row);
|
||||
|
||||
$meta_data = json_decode(base64_decode($data['meta_data']), true);
|
||||
$meta_data['source'] = 'market_data_seeder';
|
||||
|
||||
$this->rows[] = [
|
||||
'symbol' => $data['symbol'],
|
||||
'name' => $data['name'],
|
||||
'meta_data' => json_encode([
|
||||
'country' => $data['country'],
|
||||
'first_trade_year' => $data['first_trade_year'],
|
||||
'sector' => $data['sector'],
|
||||
'industry' => $data['industry'],
|
||||
]),
|
||||
'currency' => $data['currency'],
|
||||
'meta_data' => json_encode($meta_data),
|
||||
];
|
||||
|
||||
$rowCount++;
|
||||
|
||||
if ($rowCount % $chunkSize == 0) {
|
||||
|
||||
$this->bulkInsert($this->rows);
|
||||
DB::table('market_data')->upsert($this->rows, ['symbol'], ['name', 'currency', 'meta_data']);
|
||||
$this->rows = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user