Format balance availablefrom facebook api - facebook

I am trying to get the balance that a facebook ad account has positive or negative, however, I am following the facebook documentation and the same says that the field is "balance", below I am putting the print taken from the facebook documentation.
I'm getting this value according to the documentation the problem is that I don't know how to format the value correctly, the value is coming without a decimal separator, has anyone been there?
How do I know when to format the value with decimal or not?
Below is the printout of my return that I'm getting from the API.

You should consider the AdAccounts currency offset, as described here, as a static table:
Offset
Each currency has an offset which specifies how Facebook should handle
its sub-divisions. This is to ensure that the minimum bid, such as
"1", is a usable value for the currency.
Example offset 100
If a currency has an offset of 100 then the minimum allowed bid is
assumed to be 1/100 of the currency base unit. For example, if you
place a bid of "1" on an ad account based on USD the bid will be 0.01
USD.
Example offset 1
If a currency has an offset of 1 then the minimum allowed bid is
assumed to be in the currency base unit. For example, if you place a
bid of "1" on a ad account based on JPY the bid will be 1 JPY.
A sample of the table:
Name
Code
Offset
Algerian Dinar
DZD
100
Argentine Peso
ARS
100
..
..
..
Brazilian Real
BRL
100
..
..
..
Chilean Peso
CLP
1
..
..
..
So for your currency you should consider an offset of 100.

Related

How to combine the date in different columns? (Tableau)

I have a dataset ab the donor of the organization. Each row starts with donor's ID and name, home address, donate_date_1, donate_amount_1, donate_date_2, donate_amount_2, keep going until 98. It looks similar to this
Donor_ID NAME donate_date_1 donate_amount_1 donate_date_2 donate_amount_2 Total_Amount
0 A Month/Day/Year 100 Month/Day/Year 200 300
1 B Month/Day/Year 200 Month/Day/Year 50 250
2 C Month/Day/Year 1000 Month/Day/Year 500 1500
The dataset has the donors' records from 1982. Every donor starts to donate on different date, ex: 2007 to donor1 is the first donation, but to donor 2 might be the 10th donation.
So here is my question: How can I combine all the dates to see which year the donors donate the most money and create the filter to see how much money was donated in total in the specific period?

Double aggregation in Tableau using LOD expressions

I am using Tableau to create a custom google analytics dashboard. I have a custom dimension named author in my google analytics view and I would like to group the date of the first page/view by author and by month having a counter.
I successfully get the date of first page/view using MIN([Date]), but I don't figure out how to use LOD expressions to double aggregate a calculation. I tried the following expression, but tableau shows an error saying that the argument I'm trying to count is already an aggregation and can no longer be aggregated.
{INCLUDE [Author] : COUNT(MIN([Date]))}
What did I miss ?
If your are trying to find the minimum of your [Date] field by your [Author] field, you might want to construct a LOD calculation to find first date, by author like so:
//Creates calculated field for [First Date by author]
{FIXED [Author] : MIN([Date])}
You also have asked about 'double aggregating'. Let's say for example that you wanted find the minimum date, by author, but also by a [Topic]. In this case, you could write:
//Creates calculated field for [First Date by author, by Topic]
{FIXED [Author],[PostTopic] : MIN([Date])}
It is also possible to nest FIXED statements within one another. Let's say for example that you wanted to show maximum [PageViews] for a single month by [Author] and also wanted to limit the time span under consideration to to the first 3 months that an author was publishing. In this case, you could write:
//Creates calculated field for [Most page views in a single month within first 3 months, by Author]
//Example assumes [Date] is a monthly (not daily) data
{ FIXED [Author], [Date] <= DATEADD('month', 3, [First Date by author] ) : MAX({FIXED [Author],[Date]:SUM([PageViews])})}

Tableau - Building a calculated field based on a filtered date range

I need to build a calculation that takes into account whether or not someone checks on a day in Tableau. Currently using Tableau 10.0.5.
For instance, say I have the following data
Date Amount
1-Oct 100
1-Oct 120
2-Oct 150
3-Oct 200
4-Oct 250
5-Oct 500
I need a way to calculate the total amount for the days that are checked in a filter. So, if a user selected Oct 1 to Oct 3, the amount would be $570. Any ideas on how to make this happen are appreciated.
I know how much we all love to work with dates in Tableau! :-)
If you are not showing dates in your viz then simply sum([Amount]) will give you the sum of amount for selected dates.
In case you want to show individual dates and sum of sales across all dates you will have to use Level of Detail Expression
{ EXCLUDE [Date]:SUM([Amount])}
Here is the URL for Example

Query to retrieve stock quotes variation from a single day

I'm quite new YQL and i've found the query to retrieve a single quote from a stock
select * from yahoo.finance.quote symbol = "YHOO"
and another query to get this same information but on date range
select * from yahoo.finance.historicaldata symbol = "YHOO" and startDate = "2016-09-01" and endDate = "2016-09-22"
What i could not figure out was: how could we retrieve quotes from a full day of trading?
I'm currently using the Yahoo finance app and notice they provide a good graphic about the price variation, so i presume there is a way to achieve it.
I also tried to read yql tables repository but on both table that i am using there is no (at least explicit) clue of how to pass hour range.
You can retrieve the complete quotes of a day by querying the Yahoo Finance API endpoint directly (not via YQL) and receiving a list in JSON format.
The end point is http://chartapi.finance.yahoo.com/instrument/1.0/$symbol/chartdata;type=$type;range=$range/json/, where:
$symbol is the stock ticker symbol, e.g. AAPL for Apple or BAS.DE for BASF traded at Xetra
$type is the type of the query, you can query for quote, sma, close, volume
$range is the desired latest days with 1d, 5d, 10d, 15d
An example query would be
http://chartapi.finance.yahoo.com/instrument/1.0/aapl/chartdata;type=quote;range=1d/json/
which gives you all quotes from AAPL from the last day.
As far as I know, you can only query for the quotes up to the last 15 days. I have not yet found a way to query for some other day further in the past.
Just my self-centric hint: check out my PHP package YahooFinanceQuery on Github, which uses an implementation of the above query and handles the returning JSON to filter the results.
As an update/extension to my previous answer I found a new API endpoint to download daily quotes.
Yahoo changed their API endpoints in early 2017.
The new endpoint is:
https://query1.finance.yahoo.com/v8/finance/chart/{$symbol}?range={$range}&interval={$interval}, where:
$symbol is the stock ticker symbol, e.g. AAPL for Apple
$range is the desired range of the query, allowed parameters are [1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max]
$interval is the desired interval of the quote, e.g. every 5 minutes, allowed parameters are [1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo]
An example would be: https://query1.finance.yahoo.com/v8/finance/chart/AAPL?range=10d&interval=1m where you receive OHLCV quotes for the AAPL stock from the last 10 trading days with a 1 minute interval. All in a nicely JSON format.
Not all $range parameters will return results with the specified $interval, but will return the nearest possible combination. For example, the "max" range will return all quotes with a "1mo" interval.

PayPal Soap API Balance for certain Date

I'm using the PayPal Soap-Api.
With the "GetBalance"-Api Operation it's possible to get the current Balance.
But for Accounting reasons, I need to fetch the Balance for every Day in a certain period. e.g.
22.01.2016, Balance: 500,00 €
21.01.2016, Balance: 425,00 €
20.01.2016, Balance: 964,60 €
...
01.01.2015, Balance: 0,00 €
I found no Api-Operation that would match my needs.
So I tried to use the "TransactionSearch"-Api Operation to get the Transactions for this period and calculate the Balance.
Since there is no documentation wether a Transaction is balance-affecting or not, my calculation always failed.
It is possible to set certain filters for the "TransactionSearch"-Api Operation like "BalanceAffecting". But also with this filter set, I get the wrong Transactions to calculate the Balance for every day.