You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to do a bulk insert of historical data. This is trivial using Laravel's Query helper:
$client = Scheb\YahooFinanceApi\ApiClientFactory::createApiClient();
$historicalPricing = $client->getHistoricalQuoteData(
"msft",
Scheb\YahooFinanceApi\ApiClient::INTERVAL_1_DAY,
new \DateTime("-1 year"),
new \DateTime("today")
);
DB::table("share_price_histories")->insert($newArray);
However, since ->getHistoricalQuoteData returns results as private members I'm lost as how to do it.
I could technically run for-next loop and convert everything to a new array, and then insert it, but having the for-next loop seems like a penalty.
I'm happy to do a pull request but I will need some guidance.
In theory one could make all the members as public access but I guess this will break some programming discipline.
Any assistance will be appreciated on how I could go about doing this.
The text was updated successfully, but these errors were encountered:
eugenefvdm
changed the title
Bulk Insert
Bulk Insert of historical data - how to access private members?
Jan 21, 2024
Proposal to amend code to allow bulk inserts
I would like to do a bulk insert of historical data. This is trivial using Laravel's Query helper:
However, since
->getHistoricalQuoteData
returns results as private members I'm lost as how to do it.I could technically run
for-next
loop and convert everything to a new array, and then insert it, but having thefor-next
loop seems like a penalty.I'm happy to do a pull request but I will need some guidance.
In theory one could make all the members as
public
access but I guess this will break some programming discipline.Any assistance will be appreciated on how I could go about doing this.
The text was updated successfully, but these errors were encountered: