• 0

Android Stock Market Application idea.


Question

I had no idea where to post this at, so I thought the programing section would be my best bet. There is an itch I have, for an application for Android, but I also don't have a programming bone in my body. So I thought I would throw this out there, if anyone is bored.

 

So I recently invested money into a stock. All i'm looking for, which seems harder to find than I would have thought, is a simplistic stock market widget that you tell it how many shares you bought, how much you bought it at and the transaction fee's. It then goes out and finds the current stock price and shows you in big numbers on your home screen how much you've currently made off the stock.

 

I made a mockup ... and I wish I made $216 on that stock!

 

I found one that worked ok, but I want an app who's primary goal in life is to tell you how much money you are up on a stock (and in big numbers)

 

19548384042_5b8ca56fdc_o.jpg

Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

You mean something like this:

TMg1wno.jpg

 

The configuration activity:

crxf0y8.jpg

 

Here's the APK. I've only tested it in the emulator mind you. If you're on Linux and have the relevant tools installed, you can test it out without installing it on a real device:

$ cd <Android/Sdk/tools>
$ ./emulator -avd Nexus_5_API_22_x86 -netspeed full -netdelay none -wipe-data -qemu -m 512 -enable-kvm &
$ adb install <path/to/apk>
I can post the code if you want to have a play around with it. Android Studio does most of the heavy lifting. Though I still prefer the terminal.
Link to comment
Share on other sites

  • 0

Good Idea, I am into stocks as you may have seen.

 

However your broker should be able to do this with their own app. Any broker worth their salt will be able to do this, I suspect you are talking about a Widget rather than app.

Link to comment
Share on other sites

  • 0

You mean something like this:

TMg1wno.jpg

 

The configuration activity:

crxf0y8.jpg

 

Here's the APK. I've only tested it in the emulator mind you. If you're on Linux and have the relevant tools installed, you can test it out without installing it on a real device:

$ cd <Android/Sdk/tools>
$ ./emulator -avd Nexus_5_API_22_x86 -netspeed full -netdelay none -wipe-data -qemu -m 512 -enable-kvm &
$ adb install <path/to/apk>
I can post the code if you want to have a play around with it. Android Studio does most of the heavy lifting. Though I still prefer the terminal.

 

Can you sent me the source in a pm? I'm starter in android programming and code like this is always great to look at and to learn from ^^

Link to comment
Share on other sites

  • 0

Can you sent me the source in a pm?

Sure. It's in Android Studio project directory format, but it's easier enough to edit/view it with other tools. Android Studio is pretty helpful if you're just starting. It creates most of the skeleton code for you.

I'm starter in android programming and code like this is always great to look at and to learn from ^^

I wouldn't get your hopes up too fast, I knocked this up very quickly so it's rough around the edges ;)
Link to comment
Share on other sites

  • 0

Sure. It's in Android Studio project directory format, but it's easier enough to edit/view it with other tools. Android Studio is pretty helpful if you're just starting. It creates most of the skeleton code for you.

I wouldn't get your hopes up too fast, I knocked this up very quickly so it's rough around the edges ;)

I use android studio myself too and it can't be as rough as my code xD

Link to comment
Share on other sites

  • 0

You mean something like this:

 

The configuration activity:

 

Here's the APK. I've only tested it in the emulator mind you. If you're on Linux and have the relevant tools installed, you can test it out without installing it on a real device:

$ cd <Android/Sdk/tools>
$ ./emulator -avd Nexus_5_API_22_x86 -netspeed full -netdelay none -wipe-data -qemu -m 512 -enable-kvm &
$ adb install <path/to/apk>
I can post the code if you want to have a play around with it. Android Studio does most of the heavy lifting. Though I still prefer the terminal.

 

 

Looks great. So far I'm very impressed. Installed it and have 2 questions.

 

1) How long does it take to go find the stocks current price and how often does it check? At the moment the price is 0. You may need to add a small refresh button to one of the corners.

2) If you want, a transparency option would be nice too.

Link to comment
Share on other sites

  • 0

1) How long does it take to go find the stocks current price and how often does it check? At the moment the price is 0. You may need to add a small refresh button to one of the corners.

That's probably a bug I recently found. Specifically relating to the parsing code and the data format. I've fixed it now though. A simple look-ahead assertion took care of the quote embedded comma in the company field:

@Override
protected void onPostExecute (String result) {
    String [] tokens = result.split(",(?=[^\"]*$)", 3);
    updater.doUpdate(new StockQuote(tokens[0].replace("\"", ""), ParseWithDefault.parseFloat(tokens[1], 0),
            ParseWithDefault.parseFloat(tokens[2], 0)));
}
Facebook is a good example of that. If you're still getting 0 for the last trade, then it's either another bug, or the data isn't available for that particular stock. PM me if you want me to check a specific one.

Edit: Actually looking at it, it might be more efficient to precompile that regular expression.

The update interval is currently set to 180000 milliseconds (3 minutes). I implemented a custom broadcast receiver so the widget could update more frequently than the minimum of 30 minutes that AppWidgetProvider limits.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="interval">180000</integer>
    <string name="alarm_intent">android.appwidget.action.ALARM_UPDATE</string>
</resources>

2) If you want, a transparency option would be nice too.

bU18gPy.jpg
Link to comment
Share on other sites

  • 0

That's probably a bug I recently found. Specifically relating to the parsing code and the data format. I've fixed it now though. A simple look-ahead assertion took care of the quote embedded comma in the company field:

@Overrideprotected void onPostExecute (String result) {    String [] tokens = result.split(",(?=[^\"]*$)", 3);    updater.doUpdate(new StockQuote(tokens[0].replace("\"", ""), ParseWithDefault.parseFloat(tokens[1], 0),            ParseWithDefault.parseFloat(tokens[2], 0)));}
Facebook is a good example of that. If you're still getting 0 for the last trade, then it's either another bug, or the data isn't available for that particular stock. PM me if you want me to check a specific one.

Edit: Actually looking at it, it might be more efficient to precompile that regular expression.

The update interval is currently set to 180000 milliseconds (3 minutes). I implemented a custom broadcast receiver so the widget could update more frequently than the minimum of 30 minutes that AppWidgetProvider limits.

<?xml version="1.0" encoding="utf-8"?><resources>    <integer name="interval">180000</integer>    <string name="alarm_intent">android.appwidget.action.ALARM_UPDATE</string></resources>
bU18gPy.jpg

I checked the hash of the APK from the one I got yesterday from you and the one from today on the same link and the hashes didn't match so I uninstalled and reinstalled and now the widget is working! How often does it refresh? After checking it on my phone for the last half hour I'm not sure how often it refreshes but it seems to refresh often enough

In the end, I think you should upload this to the playstore and charge .99 for it. I would have totally given someone .99 in fact once this works i'll give you .99 :D

Maybe you could make a lot off this application.

Link to comment
Share on other sites

  • 0

Did another Mock up of the large view if a user wanted to put it on one of their screens. I removed the up or down arrow indicating which way the stock was going, but replaced with color coding. Red if the stock is down Green is the stock is up. But if you are still making money on the stock even though it's down, the Amount will be in green but the box will be read. Same goes for the total amount at the bottom. Green if up . red if down. :D

 

19161881093_c6c8e65a50_c.jpg

 

This was a failed mockup because I forgot to adjust the total amount to the correct number ... the Apple isn't centered either, but it gives you an idea of what it looks like when the total is in red but the apple is green..

 

19161680493_6e1451c375.jpg

Link to comment
Share on other sites

  • 0

I checked the hash of the APK from the one I got yesterday from you and the one from today on the same link and the hashes didn't match so I uninstalled and reinstalled and now the widget is working!

I often update my dropbox links ;) I'm always improving my LCARS setup (time permitting) as well.

How often does it refresh? After checking it on my phone for the last half hour I'm not sure how often it refreshes but it seems to refresh often enough

As I said, it should update approximately every three minutes at the moment. An option in the configuration screen to allow the user to decide would probably be better though. That and the colour, opacity, currency, data source, etc. Most of the functionality is in place behind the scenes, it just needs wiring up with the configuration activity.

In the end, I think you should upload this to the playstore and charge .99 for it. I would have totally given someone .99 in fact once this works i'll give you .99 :D

Well you came up with the idea. I'm just the coding monkey :D. Seriously, I don't think it's ready for that (yet). It would need a lot more polish before I'd consider that.

Maybe you could make a lot off this application.

I believe in free software. I had fun writing it and that's what's important to me.
Link to comment
Share on other sites

  • 0

I had fun writing it and that's what's important to me.

 

A.k.a Choose a job you love, and you will never have to work a day in your life. :)

  • Like 2
Link to comment
Share on other sites

  • 0

Here is a color coding mockup of your current design for just single widgets

 

19596804209_98f550cd27_c.jpg

I like the idea. Informative at a glance.
Link to comment
Share on other sites

  • 0

I like the idea. Informative at a glance.

 

Ya after my mockup I went back to my phone and I had to study it for a moment to figure out what was going on. I was like.... Oh ya color coding would be great.

Link to comment
Share on other sites

  • 0

Ya after my mockup I went back to my phone and I had to study it for a moment to figure out what was going on. I was like.... Oh ya color coding would be great.

hQ4LylN.png

Dynamically changing the background is surprisingly difficult from a WidgetProvider class because you don't have access to findViewById.

views.setInt(R.id.widget_layout, "setBackgroundColor", context.getResources().getColor(drawableTrend.get(sq.getTrend())));
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.