How to get yodlee invesment holding with top gainer and top looser? - yodlee

How to get Investment Holding from Yodlee?
I want to show:
Total Holdings
last 30 days Holdings
1 day holdings

You will be able to holdings information by calling-
https://developer.yodlee.com/apidocs/index.php#!/holdings/getHoldings Get Holdings API
upon successful account addition with Yodlee.

Related

SQL query for deposits and withdrawals. With condition the withdrawals after 3 months don't count

I'm trying to solve this task. But I can't understand how to add 3 months condition right. Please help
Partners receive bonuses for every client that they introduce to the company. Assume that the company has 3 active partners.
Partner paid on a monthly based - for every introduced client partner gets 0.5% of the amount deposited by the client excluding withdrawals. But, with the condition that if the client withdraws the amount more than 3 months after the amount was deposited – such withdrawals are not included in the partner’s bonus reduction.
For example, in August partner’s client deposited $1000 and withdraw $100. Partner gets (1000-100)*0.5%=$4.5. But in case the $100 withdrawal is from the deposit made by the client in April, in this case, the partner’s bonus is (1000)*0.5%=$5
Task: write a SQL script that calculates the monthly bonus amount for each partner.
Data is in the link [1]: https://docs.google.com/spreadsheets/d/17xo_gnu9nEwXuCNb8vBLEVrhPEKJaIRN/edit?usp=sharing&ouid=112201519964034772995&rtpof=true&sd=true
Between worls only when the date left of the AND is lower tha the right.
So your code mus look like
select
*
from
transactions
where date=any (select
date
from
transactions
where type='withdrawal'
and date between (date - interval '3 month') AND date)
and type='deposit'
order by 1,3,7

SQL Database Design for monthly issued coupons

I'm struggling with a database schema for a problem I'm having.
Let's say I own a business that sells monthly services (cleaning) to different companies.
However, I give companies monthly saveable 'coupons' that act like a reduction (of 5 dollars) based on their amount of users.
Example:
It's april 2018
Company XYZ has to pay 1.000 dollars for their monthly cleaning services by my business.
XYZ, has 5 employees, so they will have 5 coupons for the month of april.
HOWEVER, since coupons can be saved (for a period of 2 months), company XYZ will not use the coupons of only april, but also of march (since they didn't use any that month and february coupons are already used up).
Result:
10 coupons are used on their april invoice (5 of march, 5 of april):
total amount to pay 950 dollars
My thing is that I want to automate this. With one click on the button, my system will have to check:
How many users there are
If there are any unused coupons from last 2 months (and use those first if they exist)
Apply coupons to their invoice.
I want to design this first in a database but i'm struggling:
This is my design
Company
CompanyID
Name
User
UserID
CompanyID
UserID
Now I'm struggling with the coupon design, how can I develop this so that I can automise my problem.
I will need to save coupons per company per month.
My idea is to do it like this:
Company_Month_Coupon
CompanyID
Coupon_Count
Month
I wasn't sure if i could do this in one table and i'm not so sure with the following problem:
what if my program user decides to cancel an invoice, how would my system know from which month the coupons came?
What design would be adviced in a coupon-sharing system?
Any advice to tackling this problem would greatly appreciated.
I would go with your idea and have 2 more tables: Invoices and Invoices_UsedCoupons
Invoices:
ID (Primary key)
CompanyID
Month
Status (to set a cancelled status on your invoice if you don't want to delete from the DB)
Invoices_UsedCoupons:
InvoiceId (foreign key to Invoices table)
Coupon_Count
Month (this field is for the used coupons from Company_Month_Coupon table)
The reasons for this:
We should still store the issued coupons (in your Company_Month_Coupon table) because for each month, the number of employees may change. It means that you have to keep track of the issued coupons whenever the number of employees changes.
With Invoices and Invoices_UsedCoupons table, you could easily calculate the actual used coupons & the remaining coupons.
what if my program user decides to cancel an invoice, how would my
system know from which month the coupons came?
All the information is available in Invoices and Invoices_UsedCoupons tables. If you want to reclaim coupons after cancelling the invoice, it's also easy to do.
"I will need to save coupons per company per month."
Maybe you can do the opposite. In the database does not store coupons that can be used, but only those that are actually used, for example in the table "used_coupons"
The idea is that the coupons are given up by default, so it makes no sense to store them. Only need to save the used coupons.
At checkout you need to find out how much users is in the company and how many "used coupons" is saved in the last two months.
If X coupons are returned then from the "used_coupons" table you need to delete the latest X coupons.

Month and year to display inbetween dates by creating a new table

I'm using MS Access 2010 and am writing a program to display the lease amount to be paid over a period of 36 months. Once I have entered the contract into a table I use the following expression:
Charge: IIf(Date()>[1StartDate] And (Date())<=[2StartDate],[1Sched],
IIf(Date()>[2StartDate] And (Date())<=[3StartDate],[2Sched],
IIf(Date()>[3StartDate] And (Date())<=[4StartDate],[3Sched],
IIf(Date()>[4StartDate] And (Date())<=[5StartDate],[4Sched],
IIf(Date()>[5StartDate] And (Date())<=[EndDate],[5Sched],"0")))))
This shows the correct Rental amount to be invoiced but I would like to display the entire 36 months schedule so that when I run batch invoicing one specific month at a time will be ticket off as having been processed. How may I accomplish this?

Shopify api total sales

how can i get total sales from shopify store for api call? anyone have idea?I got total price by date but not total sale.
I need total sales by min and max date.
Thanks in advance.
You can get the total amount of orders that you need for the range that you need, then get the ceiling of the order count divided by the amount per page (this will get you the total amount of pages you need to get). For example, if you have 730 orders for a day and 250 orders per page, you will need to get 3 pages of orders. You can then get the 3 pages of orders and add up the totals.
https://docs.shopify.com/api/reference/order#count
you have to loop the order list response and sum up the "total_price" field. If you need accuracy you have to subtract any refunds sum from your total sum.
Yes there is a json object for refunds. In Python you can retrieve the refund information with json_response['orders'][number_in_the_list]['refunds']. Make sur to add to your GET request the status=any endpoint so you'll get /admin/api/2021-07/orders.json?status=any plus your other endpoints.

WHMCS the first year and the next year the price cycle

How to add first year and next year price cycle like that,
First year my package price : £199, but next year would be £99.
How to set like that package in pricing on WHMCS
You can add £100 as setup fee and £99 as the price for your package. So, the first invoice will be generated of £199 and from the next invoice, it will be £99.
Check the Pricing Tab from http://docs.whmcs.com/Products_and_Services#Products
On Product/Services (Client Profile) there is First Payment Amount and Recurring Amount
Put £199 at First Payment Amount and £99 at Recurring Amount and Save Changes