Screening stocks using Yahoo Finance API (YQL) - database

i am trying to roll my own stock screener using the Yahoo Finance API.
While it is easy to get a heap of data (via XML or JSON) by providing the ticker symbol:
SELECT * FROM yahoo.finance.quotes WHERE symbol="RBS.L"
(See the results here and click 'test').
I am struggling to find a way to find stocks which match a certain set of criteria. For instance, say I want to grab a list of stocks whose Bid price is greater than 20
SELECT symbol FROM yahoo.finance.quotes WHERE Bid > 20.00
The query fails, with the following message:
Cannot find required keys in where clause; got 'Bid', expecting required keys: (symbol)
as can be seen here.
Is what I am trying to do possible? Is there a way to write the query string to get what I am looking for? Or is there a much simpler service out there that can help me out.
Would appreciate any help you guys can give me.

Related

How to add sets and reps to Exercise collection in Firebase Firestore

Perhaps, I am not asking the correct question, this has been the issue for me (not fully understanding the problem), and Im not actually sure what it is that Im trying to ask or solve exactly, but I will explain my thoughts as best I can.
I am currently trying to create a fitness tracker app. I am currently using firestore database. To keep it simple I just want to be able to select an Exercise (i.e bench press), and then have sets attached, with reps and the amount of weight inside the reps category. Currently I am thinking about it as...
Collection: "Exercises"
Documents:
Field: Name: Bench Press
Field: Muscle Group: Chest
I would like to be able to select the Exercise name, and then prompt the user to individual sets that have fields that accept a number for the weight (lbs) and reps. I would like the numerical fields to have default values of null or 0 since the application is awaiting on that data to be entered by the user. Any help would be greatly appreciated as this is my first web app project I am building in React.

Access a field from another table using the object relation

I am new to SalesForce and SOQL so sorry in advance if the question has already been answered, if yes link it to me.
The aim of my SOQL query is to get all the contract information to generate PDF.
There are tables: Contract, Contact and Account
In the Contract table there are fields: Maitre_d_apprentissage__c, MaitreApprentissageNom1__c, MaitreApprentissagePrenom1__c, Apprenti__c, ApprentiNom__c, ApprentiPrenom__c
There are relationships:
Apprenti__r which link Apprenti__c to Contact table
Maitre_d_apprentissage__r which link Maitre_d_apprentissage__c to Contact table
When I looked at table, I saw that MaitreApprentissageNom1__c was equal to Maitre_d_apprentissage__r.LastName and ApprentiNom__c was equal to Apprenti__r.LastName. So I conclude I could get other information of Apprenti__c and Maitre_d_apprentissage__c from the Contact Table following the same principle. So I added to my query Apprenti__r.Date_de_naissance__c and Maitre_d_apprentissage__r.Date_de_naissance__c to get the Date_de_naissance__c field which is in my Contact table.
I see in the results that the query succeeds in getting the information but some values have changed column (lines 6 and 7), you can see the difference between query 1 and query 2. In the first query I only return the Apprenti__r.Date_de_naissance__c and in the second query I return Apprenti__r.Date_de_naissance__c and Maitre_d_apprentissage__r.Date_de_naissance__c
Query 1:
SELECT ApprentiNom__c, ApprentiPrenom__c, Apprenti__r.Date_de_naissance__c, MaitreApprentissageNom1__c, MaitreApprentissagePrenom1__c
FROM Contract
Result 1:
Query 2:
SELECT ApprentiNom__c, ApprentiPrenom__c, Apprenti__r.Date_de_naissance__c, MaitreApprentissageNom1__c, MaitreApprentissagePrenom1__c, Maitre_d_apprentissage__r.Date_de_naissance__c
FROM Contract
Result 2:
I would like to understand from where is coming the problem and how to correct it. Thank you in advance.
It's possible that it's just your query editor displaying stuff incorrectly. You can see it got confused with 2 lookups to Contact table, why there's even a column header "Contact.Date_de_naissance__c" (and why it's there twice). And they aren't shown in the order you requested...
What editor you're using? You could try built-in "Developer Console" or http://workbench.developerforce.com/
What do you need it for? In Apex order of fields won't matter, in REST API query the values fetched via lookup will come as JSON sub-objects so there will always be a way to figure out exactly which value is coming from which relation.
In Dev Console try to run this and check if it solves your fears:
System.debug(JSON.serializePretty([SELECT
ApprentiNom__c, ApprentiPrenom__c,
Apprenti__r.Date_de_naissance__c,
MaitreApprentissageNom1__c, MaitreApprentissagePrenom1__c,
Maitre_d_apprentissage__r.Date_de_naissance__c
FROM Contract]));
Then add Maitre_d_apprentissage__r.LastName to query and see what changed, what stayed as is.

QBO SDK PHP getting all deposits customer

I would like to know how to get all deposits of a target customer with the following SDK (https://github.com/intuit/QuickBooks-V3-PHP-SDK).
Is there an easier way than getting all deposits, then looping to extract the wanted customer's deposits?
Official QBO answer:
You can get complete deposit list by querying the “Query a deposit”
API end point. If we use filter in query, then it may return incorrect
results. Better you can iterate the response and add filter logic in
your code and get specified

How to check that a cycle exists in a Neo4j database ;

Trying to learn Neo4j, graph DB and using a test setup where i'm representing users who want to trade fruits.
Im trying to find a situation where there exists a "3 person trade" or a direct cycle between 3 or more persons in the system.
This is the scenario i'm trying to store
userA has apples , wants cherries
userB has bananas, wants apples
userC has cherries , wants bananas
So a trade is possible in the above scenario,if the 3 parties are involved in the trade. I need a query that will return the names of the traders/persons.
Need help representing this and writing the code to be able to solve this query. For the scenario, this is the cypher i'm using:
(userA)-[r:has]->(apples) (userA)-[r:wants]->(cherries)
(userB)-[r:has]->(bananas) (userB)-[r:wants]->(apples)
(userA)-[r:has]->(cherries) (userA)-[r:wants]->(bananas)
Also tried using this :
find the group in Neo4j graph db , but that query didnt work ..
thanks for any info, that can help!
The initial approach would be something like this:
MATCH (userA:User)
WHERE (userA)-[:WANTS]->() AND (userA)-[:HAS]->()
MATCH (userA)-[:WANTS]->()<-[:HAS]-(userB)-[:WANTS]->()<-[:HAS]-(userC)-[:WANTS]->()<-[:HAS]-(userA)
RETURN DISTINCT userA, userB, userC
That said, you may need to adjust this based on how big your graph is, and how fast the query runs on your graph.

Salesforce rest api Events WhoId

I am using salesforce rest api to pull meeting data.There is a field "WhoId" in the reponse which according to the documentation is the related lead or contact id .How do i find whether it is a lead or contact?
You can always tell what sort of object an ID corresponds to by looking at the first 3 letters. In your case, you'd look for a prefix of 00Q (Lead) or 003 (Contact).
See: https://salesforce.stackexchange.com/q/1653
Backup copy of the full table gisted (just in case!) and rendered for your future convenience.

Resources