I found the Flexinode module to be pretty incredible in its ability to create sortable tables of data and also to display lists. I have created a flexinode for stock deals that I'm tracking. I would love to be able to enable my users to view this information in the tabular view and sort by the current change in stock price. The stockapi module looks like it is perfect for getting the latest stock ticker info.
I would love to have the stock information in stockapi for each stock deal imported into my new flexinode. My current idea is that I need to create a new module that looks in the specified flexinode field for the stock ticker and then request the stock ticker info from the stockapi module. Then the stock ticker info would get written to the flexinode_data table for each stock deal node in separate fields for each piece of stock information from stockapi. The updates only need to occur once an hour.
Does this sound like it would work? Is a .inc for the flexinode module the more appropriate way to go?
I'm in the process of learning php and how to program modules, so I'm not very skilled at it yet. If this project is feasible, I would appreciate any help getting started with the code. I'll share the final product with the community to help others with a similar need.
Comments
Updating flexinode stock prices
You don't need the stockapi. Just create a new module with a cron job that updates the flexinode_data table. I wrote this quick module for George:
Thanks
Great idea Theo combining the functions into one module. I got the code you provided to work on the first try.
Now I need to create another variable that takes the current price and calculates the potential percent gain from the tender price. It seems like this should be pretty easy to do, if someone knew what they were doing. However, I'm not so sure I know what I'm doing. ;-)
Adding a calculation and some help understanding the code
I have been studying the module you prepared for me above. After reading a few basic tutorials, I seem to understand most of the code, but there are a few things I still don't understand.
Two things dawned on me when I started playing with the module. I need to calculate the "potential percent gain" between the current price and the tender price for the stock deals I am listing. This is one of the key variables my users want to sort the list by.
Potential percent gain = (tender price - current price)/(current price)
How hard do you think it would be to add this to the above code? Anyone willing to take a stab at it?
In trying to understand the module code shown above, I realized that I don't understand what '%s' and %d" are and I'm having trouble searching for those terms. I'm also trying to figure out what -> means when used in for example $record->field_id; and $q->symbol. These are probably easy concepts for people here, but I'm still try to learn this stuff.