Dibatalkan

PHP nested arrays to mysql

I need to extract certain data from external json into mysql. After decoding my json looks like this: Array ( [key1] => 1 [key2] => [key3] => Array ( [0] => Array ( [Id] => x1 [TimeStamp] =>y1 [Quantity] => z1 [Price] => q1 [Total] => w1 [FillType] =>e1 [OrderType] =>r1 ) [1] => Array ( [Id] =>x2 [TimeStamp] => y2 [Quantity] => z2 [Price] => q2 [Total] => w1 [FillType] => e1 [OrderType] => r2 ) [2] => Array .....and so on. I need to upload to my mysql three keys/values for each transaction, that is 'ID', 'TimeStamp', and 'Total'. I want to update that database every 5 minutes so that only data with newer 'TimeStamp' are added. Then I need to check the combined value of 'total' for the last 15 minutes, last (30-15) minutes, and value of 'total' for last 120 minutes divided by 8.

Hello, I send you some more info about what I need.
I want to make sure we understand eachother.

I download data from external server. It comes as json.
After after get_file_contents and json_decode true i receive nested arrays, which after print_r looks this way:

Array ( [success] => 1 [message] => [result] => Array ( [0] => Array ( [Id] => 111745476 [TimeStamp] => 2017-12-05T19:50:58.19 [Quantity] => 1.2 [Price] => 0.00857242 [Total] => 0.0102869 [FillType] => PARTIAL_FILL [OrderType] => SELL ) [1] => Array ( [Id] => 111745427 [TimeStamp] => 2017-12-05T19:50:56.113 [Quantity] => 0.10285719 [Price] => 0.0085831 [Total] => 0.00088283 [FillType] => FILL [OrderType] => BUY ) [2] => Array ( [Id] => 111745412 [TimeStamp] => 2017-12-05T19:50:54.787 [Quantity] => 0.41726852 [Price] => 0.00858651 [Total] => 0.00358288 [FillType] => FILL [OrderType] => SELL ) [3] => Array ( [Id] => 111745187 [TimeStamp] => 2017-12-05T19:50:46.83 [Quantity] => 19.13589601 [Price] => 0.00859 [Total] => 0.16437734 [FillType] => FILL [OrderType] => BUY )

and that is just a tiny part. I want to extract values from Id, TimeStamp and Total, where [0], [1], [2] are transactions on crypto exchange.
Then I want these to be transfered to mysql database every 5 minutes, but only with transactions that are newer (have bigger Id), so the old stay and new are added.

I use Bittrex exchange. You can see API here: https://bittrex.com/home/api

I will be using getmarkethistory with parameters

code looks like this

$apikey='';
$apisecret='';
$nonce=time();
$uri='https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-LTC'; that is Bitcoin-Litecoin market history
$sign=hash_hmac('sha512',$uri,$apisecret);
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign));
$execResult = curl_exec($ch);
$obj = json_decode($execResult);

I will provide with apikey and apisecret if we come to an agreement.

My mysql database is called Bittrex. In that database there are tables with cryptocoin pairs. That is btc-ltc table, btc-xxx table, btc-yyy table and so on.
Each table has colums named Id, TableStamp and Total, where the ids, timestamps and totals for each transaction encoded in json should go.
I will need help with what type, atributes, and defaults should every column have (as for know Id is int, TimeStamp is timestamp NULL, and Total is decimal)

Next step is to summarize 'Total' values for last 15 minutes (let's call it A), for period between 30 and 15 minutes ago(let's call it B),
and average value for 15minute periods in last 2,5hours (2,5hours ago to 0.5 hours ago) - that's C

The new part I did not write about before is that if B is at least 3 times bigger than C, and A is bigger that B I want php to echo timestamp when 'if' was true and name of the pair of currencies.
For example: 2017-12-05T19:50:44.99 BTC-LTC. I want it stay on www page until restart (or just forever if its easier to do)
Additionally I want that to be sent to my FBmessenger.

I want to track more than 100 pairs of currencies. I don't need you to prepare all of those. I just need one pair, than I will copy/paste the code and
make necessary changes in json url, function name (is it a good idea to make a function called for example BTC-LTC? This way the function name could be echoed in messages?), table names and so on.

And last part: if it's possible I would like four values that is A (15 minutes), B (period between 30 and 15 minutes ago), C (2,5hours ago to 0.5 hours ago), and D(at lease X times bigger)
to be editable like a constant, same one for every function, so somewhere at the top of the php code.
I will run it on localhost.
Please feel free to ask questions.

Kemahiran: PHP

Lihat lebih lanjut: how to insert multiple array in mysql php, php create multidimensional array from mysql result, php sql result to multidimensional array, how to store multidimensional array in database, while loop multidimensional array php, php create multidimensional array from database, multidimensional array php mysql query, insert multidimensional array into mysql, php nested menu mysql, nested sortable mysql php, php form email mysql, php parse xml mysql, php soap webservice mysql, php form process mysql, php phone directory mysql

Tentang Majikan:
( 1 ulasan ) Poznań, Poland

ID Projek: #15808250

Dianugerahkan kepada:

sun0815

Hello,client I'm interested in your job This is php script job. I'm expert of script I have built many php scripts. I can do in 1 day Please discuss more details via chat Thanks Relevant Skills and Experience Lagi

$120 USD dalam sehari
(17 Ulasan)
5.6

40 freelancers are bidding on average $130 for this job

extreamcode

HI There, I can assist you with "PHP nested arrays to mysql", I have experience working with "similar Development". Let's have a quick chat to discuss it further. Relevant Skills and Experience I have been in this "P Lagi

$155 USD dalam 3 hari
(62 Ulasan)
7.4
gangabass

I can create PHP script that will work like you want (parsing JSON, uploading it into MySQL, calculating totals etc) in less than 6 hours. Relevant Skills and Experience I have worked on similar projects dozens of tim Lagi

$90 USD dalam 0 hari
(233 Ulasan)
6.7
glennwilkins

sir pm me im good in php i can finish this job fst Relevant Skills and Experience php Proposed Milestones $90 USD - price

$90 USD dalam 0 hari
(114 Ulasan)
6.0
$70 USD dalam 2 hari
(83 Ulasan)
5.5
umernaeemucp

hi i read the requirement just one thing can you explain the 5 minute scenario which you are saying in the description Relevant Skills and Experience wordpress php Proposed Milestones $155 USD - final

$155 USD dalam 3 hari
(18 Ulasan)
5.1
$155 USD dalam 3 hari
(15 Ulasan)
4.7
justdotweaks

Hello Sir/mam, As a Web & App development company we have investigate your project and find that we can do this but first i would like to show u my exp. Relevant Skills and Experience Our specialities: - iOS/Android d Lagi

$155 USD dalam 3 hari
(22 Ulasan)
5.1
SohaibRehman17

Five star technologies passion Relevant Skills and Experience I have 7 years experience with your project skills i'm specialist with your project project flow sir Proposed Milestones $120 USD - work Hi sir can you p Lagi

$120 USD dalam 3 hari
(21 Ulasan)
4.8
softcarve

Hi there, My name is Manish. I would like to write PHP script to save error and do the calculations over it. please get in touch to discuss more. Relevant Skills and Experience I have good proficiency in PHP, mysql Pl Lagi

$55 USD dalam 2 hari
(32 Ulasan)
5.1
Tushar051

I have 100% job completion rate:) I have above 5yr of experience in Web Development & Designing, Web application development. Relevant Skills and Experience My strengths are in PHP, Codeigniter, Laravel, Wordpress, M Lagi

$150 USD dalam 3 hari
(13 Ulasan)
4.8
DevvTime

Hello there i am a professional and have extensive experience with these type of tasks, can you please pm me right now? i am waiting Thanks regards Relevant Skills and Experience php,mysql,json Proposed Milestones $1 Lagi

$112 USD dalam 4 hari
(23 Ulasan)
5.0
meeshal1994

Hello, I can do it in few hours. Contact me if you want. Thanks

$160 USD dalam 0 hari
(21 Ulasan)
4.9
$98 USD dalam 3 hari
(23 Ulasan)
4.7
tyang0928

Hello, I am a senior web developer , with over 10 years of experiences. I am master of mysql database management and php script. I can help you asap. [url removed, login to view] Relevant Skills and Experience I am master Lagi

$155 USD dalam 3 hari
(15 Ulasan)
4.7
divyinfotech

We provides excellent services in satisfied price and on decided time. Relevant Skills and Experience *MS OFFICE,Typing *PHP,CodeIgniter,Laravel,MySQL,Angular,Javascript,JQuery,AJAX. *Native Android and IOS app develo Lagi

$150 USD dalam 3 hari
(10 Ulasan)
4.2
nvbishr

Please send me details. ......................................... Stay tuned, I'm still working on this proposal.

$90 USD dalam 2 hari
(16 Ulasan)
4.2
jayesh793

We are passionate team of developers. Till now we have competed in the local market and now we are hitting to the online market as we want to expose our skills and expertise to the another level. Relevant Skills and E Lagi

$94 USD dalam 3 hari
(9 Ulasan)
4.3
gracefulwork

I am php mysql expert with 4 years of experience also have got good hold on json data posting to database table. lets start. Thank you. Relevant Skills and Experience php mysql - 4 years. Proposed Milestones $8 Lagi

$111 USD dalam 3 hari
(36 Ulasan)
4.9
aaravkiku

Hello I seen your array code as well description and we will done your issue ASAP, so can you come on chat and lets it star? Relevant Skills and Experience We have more the 8 years of working experience on web/mobile Lagi

$194 USD dalam 3 hari
(15 Ulasan)
4.8
jarki2017

I am a good web developer. I can do it. Relevant Skills and Experience php, json Proposed Milestones $155 USD - re

$155 USD dalam 3 hari
(9 Ulasan)
3.9