New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add stock options functionality #50
Feature/add stock options functionality #50
Conversation
17982da
to
729e02a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look really good! I'd just want to have a test case for the value mapping and then we'd be good to merge.
src/ResultDecoder.php
Outdated
public function transformOptions(string $responseBody): array | ||
{ | ||
$decoded = json_decode($responseBody, true); | ||
if (!isset($decoded['optionChain']['result']) || !\is_array($decoded['optionChain']['result'])) { | ||
throw new ApiException('Yahoo Search API returned an invalid result.', ApiException::INVALID_RESPONSE); | ||
} | ||
|
||
$results = $decoded['optionChain']['result']; | ||
|
||
// Single element is returned directly in "quote" | ||
return array_map(function (array $item) { | ||
return $this->createOption($item); | ||
}, $results); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to have a test case similar to transformQuotes_jsonGiven_createArrayOfQuote
for this method. So we can ensure all expected fields are properly mapped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is updated with additional tests for the options result
d4549dc
to
184edf6
Compare
Thank you for the positive words! I do recommend re-reviewing the work since the models are expanded upon greatly since the initial pr. Thank you for your patience. Please let me know if there are any new issues. |
124b0e4
to
17acd21
Compare
Wow, you really did a great effort with the unit tests, thank you!
Other than that, I'd be happy to merge that in. |
17acd21
to
d58d79f
Compare
I squashed another commit on top. The changes should take care of those few requests. Have a great weekend! |
Thank you for your work. Has been released under v4.10.0 |
This branch contains a small refactor for cookie and crumb acquisition as well as the primary feature of a
getStockOptions
method.I have been using this package for quite a while now and love it. I have been getting more into options and I would like to enhance my own personal trading info infra by adding onto this library.
I tried my best to stick to the conventions laid out in the API/decoder and followed the formatting and checks as described in the CONTRIB. Hopefully it is up to standard.
If you have any recommendations or questions, please don't hesitate to comment.
Best,
Compo