Market order's variables I am not an economist, so my question could be stupid for you. 
However, I need to understand how market order works and which variables plays in a trade. 
For example: let us suppose I am a trader and I have at the time t=0 a sum of cash and stocks. 
How do they change?
Do I need consider intraday and daily trades?
And what about the spread between bids and asks?
I am a financial economist, so I will attempt to answer what I think you are asking.  A market order isn't one concept, it's many.  Each place that accepts trades operationalizes it differently.  It also depends upon whether it is a small order or a large order.

For a small order, the order result will clear at the bid if it is a sell order at the bid and at the ask if it is a buy order.  Only in that case will the outcome be the same everywhere.

For a large order, it depends upon where the security trades at and it can depend upon the internal policies of which broker-dealer you use.  For example, if you place a large market order on a stock that trades on the NYSE then what you are actually doing is instructing your broker to go to the floor of the exchange, to a place called the "post," and continue to bid until you are the high bidder, if buying or the low bidder if selling, until your order is filled.

On the other hand, a large market order on the NASDAQ will be filled up to the stated size limit.  After that, it depends upon a number of things.  For example, if there are multiple market makers then decisions to fill or not fill is made by each maker depending on orders they have, their inventory needs and what risks they will take and for what fee structure.  Because a market order essentially says "I will pay any price," the makers have liberal pricing powers on large market orders.  Also, the processing broker can sometimes cross the order with other orders they have pending from their own customers and so it never really makes it to the market itself, other than for record keeping purposes.

Outside of this, there are order crossing services in what have been nicknamed "dark pools," which are available to the largest financial institutions but not to ordinary traders. Different rules are in use for things other than stocks and for stocks traded in non-US exchanges.

To provide an example, imagine you own $\$1,000$ and also own 100 shares of ABC which is currently trading at 9.90 bid and 10.10 ask.  It trades on the NYSE.  A decision to sell 100 shares at market would increase cash to $\$1,990$ and reduce shares to zero.  Since you may or may not be permitted to short sell the stock depending on your contract with your broker and the availability of shares to borrow, a decision to short sell 100 more shares of ABC would increase cash by the new bid, which for our purposes will be 9.85 per share, for $985 and add one hundred shares on the short side in the margin account.  The cash will also be segregated and held as collateral on the long side of the margin account.

A large market order for a thinly traded stock could take a month or more to fill.  For a "pink sheets" stock it could take years.  For a heavily traded stock, it could take less than a second.

It is important to note that the recording of a trade for customer accounting purposes may not match market records.  Consider a person who sold 100 shares of ABC for 9.65 per share.  They record an increase in cash of $965 and a decrease in shares by one hundred shares.  The "tape" may not record it this way if it is part of a large buy order.  In that case, if the weighted average price was 10.10 then the market would see one large order for 10.10 per share, though it may also be the case that nobody actually received that amount of money.  It is also the case that the time of order completion will not match.